Challenging high CPU load

Hello,

my setup:

  • Reverse Proxy on OPNsense (running smooth)
  • Proxmox virtualisation server
    – Intel Pentium J5040 4 cores @2.00 GHz
    – 32GB RAM
  • Nextcloud VM
    – Nextcloud 22.2.3
    – 4 cores
    – 12GB RAM
    – Ubuntu 21.10, Apache2, PHP8.0-FPM, MariaDB, Redis-Server, APCu
    – http2
    – SMB mounted (same network) and used for nextcloud data directory
    – Plugin: Preview Generator

I would say that 12GB, 4 cores at 2GHz should be enough to handle 4 users. When scrolling through β€˜media’/ photos (and doing nothing else!) htop is showing me the CPU is shooting up to an average load of 2.5+ (for only one user). Processes are especially MariaDB and PHP-fpm.

I tried changing values for FPM. I gave 2GB RAM to MariaDB, and fpm:
pm.max_children = 73
pm.start_servers = 18
pm.min_spare_servers = 18
pm.max_spare_servers = 54
pm.max_requests = 1000

But nothing changed the CPU load…

Does anyone have any idea where else I can look or what else I can do? This is a brand new installation.

Best regards

1 Like

I guess you may need better CPU.

I am no expert here, but I have similar issue, though in my case, my CPU is much older and weaker but fundamental behavior of this issue is similar.

I have more users than your setup and rarely I am using more than 1 GB of system ram, even when manually setting value to allow higher RAM allocation for php memory or such.

Mainly it comes down to CPU

Here is my issue β†’ High CPU Usage NextCloud 22.2.0 (snap) on Ubuntu 20 LTS

By the way, you didn’t mention the NextCloud version of your setup. Someone in below post mentions that 22.2.3 is out and this latest version is suppose to solve this high CPU load issue. β†’ NC 22.2.1 performance warning!

I haven’t received the update yet, waiting for snap version to come up with the update.

Lastly, I am no expert, so please wait for other expert users to reply.

Thanks.

Update :- My Bad, I didn’t notice, yes, I have received the said 22.2.3 update

Although the web interface performance is now much better and overall responsiveness has gone up. Snap by default didn’t have GZip compression, I have turned that on.

However, my Intel Pentium N3530 still feels inadequate with multiple simultaneous active users. CPU usage still shoots up with php-fm and mysql when multiple active users and simultaneously transferring large files.

Thanks.

Thanks, added it…

Well, I can’t think of any reason, why MariaDB is going crazy when scrolling photos?

1 Like

Okay, please tell me I am stupid. While htop is showing Load Average 2.98 0.94 0.76 my proxmox ve tells me at the same time a CPU usage of around 25% of 4 CPU(s). Do I missunderstand htop??

Hello,

I am no linux expert, so please wait for others to reply, but as far as I know, usually hypervisor on host OS is supposed to report the total physical CPU usage where as VM htop will report that individual VM load, so not necessarily VM usage is exactly same as physical system usage.

Secondly, this is a question more suited for Ubuntu Forums or Proxmox support, I guess this is related to Guest OS and Hypervisor.

In my case, with my Intel Pentium N3530, when there are 4/5+ users/devices are actively uploading / downloading (regardless of mobile apps or web interface) or browsing, CPU usage is pinged at roof.

htop-high-load

Thanks.

You already set up the caching stuff (redis), that is great and takes load from the database. The remaining load can be reduced by adapting the database caches, especially if you don’t use all the RAM yet.
Creating preview can use a lot of resources especially when you scroll through a new media folder for the first time. There are workaround to pre-generate these previews via cronjobs:

i had the same problem on my docker installation and figured it out:
if you have not generated thumbnails in a folder nextcloud tries to generate all thumbnails instantly.

however for each image thumbnail reuquest the apache webserver fires up a worker process.
this will result in many, many apache2 threadas which all get a minimum of the CPU and will not finish - server hangs.

to solve this you can edit the apache config file and add:

MaxRequestWorkers 10

or if you use a docker container create file called nextcloudworkers.conf and include the previous line and mount it via the volume command . e.g.

{yourpah}/nextcloudworkers.conf:/etc/apache2/conf-enabled/nextcloudworkers.conf

if you use another webserver or php-fm try to limit the parallel threads/processes