From 93ff86b46555b1c744a72d76da31e9366fd3da6d Mon Sep 17 00:00:00 2001 From: Florian Schlegel Date: Mon, 8 Oct 2018 12:11:20 +0200 Subject: [PATCH 1/3] Update server_tuning.rst --- admin_manual/configuration_server/server_tuning.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/admin_manual/configuration_server/server_tuning.rst b/admin_manual/configuration_server/server_tuning.rst index b5223d31c..2b48f1a70 100644 --- a/admin_manual/configuration_server/server_tuning.rst +++ b/admin_manual/configuration_server/server_tuning.rst @@ -8,6 +8,17 @@ Using cron to perform background jobs See :doc:`background_jobs_configuration` for a description and the benefits. +Reducing system load +-------------------- + +High system load will slow down Nextcloud and might also lead to other unwanted side +effects. To reduce load you should first identify the source. Tools such as htop, +iotop or [glances](https://nicolargo.github.io/glances/) will help to identify the +process or the drive that slows down your system. First you should make sure that +you installed/assigned enough RAM. Swap usage should be prevented by all means. +If you run your database inside a VM, you should not store it inside a VM image file. +Better put it on a dedicated block device to reduce abstraction layers. + .. _caching: Caching From a2436b3b1518abdc306085265f1c621e4d514558 Mon Sep 17 00:00:00 2001 From: Florian Schlegel Date: Mon, 8 Oct 2018 13:47:34 +0200 Subject: [PATCH 2/3] Update server_tuning.rst --- .../configuration_server/server_tuning.rst | 50 ++++++++++++++++--- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/admin_manual/configuration_server/server_tuning.rst b/admin_manual/configuration_server/server_tuning.rst index 2b48f1a70..07a8d2f4d 100644 --- a/admin_manual/configuration_server/server_tuning.rst +++ b/admin_manual/configuration_server/server_tuning.rst @@ -11,13 +11,14 @@ benefits. Reducing system load -------------------- -High system load will slow down Nextcloud and might also lead to other unwanted side -effects. To reduce load you should first identify the source. Tools such as htop, -iotop or [glances](https://nicolargo.github.io/glances/) will help to identify the -process or the drive that slows down your system. First you should make sure that -you installed/assigned enough RAM. Swap usage should be prevented by all means. -If you run your database inside a VM, you should not store it inside a VM image file. -Better put it on a dedicated block device to reduce abstraction layers. +High system load will slow down Nextcloud and might also lead to other unwanted +side effects. To reduce load you should first identify the source of the problem. +Tools such as htop, iotop or `glances `_ +will help to identify the process or the drive that slows down your system. First +you should make sure that you installed/assigned enough RAM. Swap usage should be +prevented by all means. If you run your database inside a VM, you should not +store it inside a VM image file. Better put it on a dedicated block device to +reduce latency due to multiple abstraction layers. .. _caching: @@ -40,6 +41,20 @@ configure Nextcloud for MySQL or MariaDB. If your installation is already runnin SQLite then it is possible to convert to MySQL or MariaDB using the steps provided in :doc:`../configuration_database/db_conversion`. +In smaller installations you might not want to set up a separate cache. However +you can still tune your database. The following example is suited for a database +smaller than 1GB. MySQL will consume up to 1GB of RAM for caching. Please make +sure that your system has sufficient free RAM after the change, so that it does +not start to use your swap partition, when it receives a burst of requests. In +the given example your ``/etc/mysql/conf.d/mysql.cnf`` might contain the +following lines. (beware that this is the block for mysqld not mysql) + +.. code:: ini + + [mysqld] + innodb_buffer_pool_size=1073741824 + innodb_io_capacity=4000 + Using Redis-based transactional file locking -------------------------------------------- @@ -84,6 +99,27 @@ Enable HTTP2 for faster loading HTTP2 has `huge speed improvements `_ over HTTP with multiple request. Most `browsers already support HTTP2 over SSL (HTTPS) `_. So refer to your server manual for guides on how to use HTTP2. +Tune PHP-FPM +------------ + +If you are using a default installation of php-fpm you might have noticed +excessive load times on the web interface or even sync issues. This is due +to the fact that each simultaneous request of an element is handled by a +separate PHP-FPM process. So even on a small installation you should allow +more processes to run. For example on a machine with 4GB of RAM and 1GB of +MySQL cache following values in your ``www.conf`` file should work: + +.. code:: ini + + pm = dynamic + pm.max_children = 120 + pm.start_servers = 12 + pm.min_spare_servers = 6 + pm.max_spare_servers = 18 + pm.process_idle_timeout = 60s + +Depending on your current PHP version you should find this file e.g. under ``/etc/php/7.2/fpm/pool.d/www.conf`` + Enable PHP OPcache ------------------ From ed39ffcd8933c64b3786ab77a64df90f2e0b371b Mon Sep 17 00:00:00 2001 From: Florian Schlegel Date: Mon, 8 Oct 2018 15:24:40 +0200 Subject: [PATCH 3/3] Update server_tuning.rst --- admin_manual/configuration_server/server_tuning.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/admin_manual/configuration_server/server_tuning.rst b/admin_manual/configuration_server/server_tuning.rst index 07a8d2f4d..47104e7fe 100644 --- a/admin_manual/configuration_server/server_tuning.rst +++ b/admin_manual/configuration_server/server_tuning.rst @@ -52,7 +52,7 @@ following lines. (beware that this is the block for mysqld not mysql) .. code:: ini [mysqld] - innodb_buffer_pool_size=1073741824 + innodb_buffer_pool_size=1G innodb_io_capacity=4000 Using Redis-based transactional file locking @@ -116,7 +116,6 @@ MySQL cache following values in your ``www.conf`` file should work: pm.start_servers = 12 pm.min_spare_servers = 6 pm.max_spare_servers = 18 - pm.process_idle_timeout = 60s Depending on your current PHP version you should find this file e.g. under ``/etc/php/7.2/fpm/pool.d/www.conf``