NextCloud Performance Optimizations - Please Contribute!

About MySQL buffer tweak:

I followed your links till the end and found this settings for the my.cnf:

  • innodb_buffer_pool_size = 512M
  • innodb_buffer_pool_instance = 1
  • innodb_flush_log_at_trx_commit = 2
  • innodb_log_buffer_size = 32M
  • innodb_max_dirty_pages_pct = 90

innodb_buffer_pool_size defaults to 128M: source
Increasing it should of course depend on your system and there should be enough memory left for the remaining to run safely. Also it doesn’t make sense to increase the buffer, if the database is too small to fill.

innodb_buffer_pool_instance already defaults to 1, so there is no need to change: source

Reading on it seems, that at least the change of innodb_flush_log_at_trx_commit can lead to data loss when the system looses power. So this should only be set, if there is a battery backup or something. Also the performance improvement was not confirmed by all, but most of the users.

innodb_log_buffer_size defaults to 8 (source), so yeah, at least it seems consistent to adjust it by the same factor then the buffer pool size.

innodb_max_dirty_pages_pct is the percentage of dirty pages that is tried to no exceed by flushing the buffer regularly. I don’t have enough knowledge about it, but it has benefits and disadvantages to adjust this value and there will be some reason, why it defaults to 75 (%): source

I am always interested in increasing the performance of my nextcloud server, but as I already thought: Just changing the default values of database, webserver, php, whatever, to a set, given by some random user (of course I appreciate the hints, and it will work for his specific system/setup) is not an always good advice and should be taken with care. There are good reasons why the standard values are set as they set. Of course they are not set to maximum performance but indeed to a good compromise of stability, compatibility and performance.

Upgrading to PHP 7 and using file caching/locking should be some good way to increase performance along with other hints in the admin manual.

@Rello: /var/tmp seems to be used for temporary files, that are meant to survive reboot, as far as I could find out. I don’t know how important this is and if it could lead to problems, but this should be kept in mind. /tmp on the other hand seems to be for files, that do not “need” to survive reboot. Of course its always a question how this folder are actually used by the system. At least for the /tmp folder there is already a setting in debian jessie: /etc/defaults/tmpfs
RAMTMP=yes
It defaults to no, set to yes should add it to tmpfs after reboot.

By the way: While having a look into the nextcloud admin manual I found some default php mysql configuration for /etc/php5/conf.d/mysql.ini. But actually with PHP7 I don’t have this file, nor could I find some mysql.ini anywhere. mysqli.ini and mysqlnd.ini instead. Does anyone know which file I have to adjust according to the manual with PHP7?