Nextcloud – fine-tuning

After few years of using Nextcloud service running as LXC container on my Proxmox server it is time to check its condition and apply some improvements to make Nextcloud working faster. In this short article you can see how do I changed some settings to make Nextcloud more responsible especially when playing stored video files.

Introduction

I am running Nextcloud instance as a CT in Proxmox on the machine with these parameters:

  • CPU: Intel Atom N2800 (2 cores, 4 threads)
  • RAM: 4GB DDR3
  • LSI Megaraid as a RAID controller
  • 2x 2TB HDD working in RAID1

For the CT I set 2 cores and 2GB of RAM. The rest of the machine resources are used for another CT with another service.

The specification is just a little bit silly, especially CPU but the server is working fine and it is enough to run Nextcloud instance for 4 users and 6 devices.

PHP-FPM processes issue and solution

When playing a video file in the web browser I noticed that some processes are using 100% of the CPU. On some sites I found that the issue is caused by the php-fpm processes and it is required to change options which are responsible for processes. In the sources you can find the link to the PHP-FPM processes calculator. In my case the calculated values looks like this below:

In my configuration I set pm.max_children to 22 and pm.max_spare_servers to 16.

Caching

I decided to improve the PHP-FPM caching by applying these parameters:

  • opcache.enable = 1
  • opcache.save_comments = 1
  • opcache.interned_strings_buffer = 8
  • opcache.max_accelerated_files = 10000
  • opcache.memory_consumption = 128
  • opcache.save_comments = 1
  • opcache.revalidate_freq = 60

It is better but sometimes server stucked…

After applying parameters I set this parameter:

  • pm = static;

After reloading the PHP-FPM service and few more days of testing my Nextcloud instance is working much better then before.

Conclusion

In this article you saw my server improvements to make Nextcloud instance more reposnsible. The above parameters may be different for other server with better CPU, more RAM. Please treat this article as a guide how to make your Nextcloud instance working better.

Sources