App become unresponsible, Error "reached MaxRequestWorkers setting …"
-
Hi there,
for some time now, I have noticed that the Nextcloud GUI freezes for a few minutes. Recently I wanted to empty the trash.
The log shows the following error.
[mpm_prefork:error] [pid 1] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting => Healtheck error: Error: Timeout of 7000ms exceeded
The problem has already been discussed in the forum with other apps, but always without a conclusive result.
-
Let's try to reach a conclusion this time around
The solution here is:
- Edit
/app/data/apache/mpm_prefork.conf
. - Adjust the MaxRequestWorkers settings there
- Adjust the app's memory limit accordingly as well.
- Restart the app
The correct values to be put in prefork is better explained by the upstream docs - See https://httpd.apache.org/docs/2.4/mod/prefork.html . The configuration depends much on how much memory you have, what load you expect etc.
Unfortunately, there is no easy math to figure out these values. For example, to figure out memory limit automatically is not possible. It depends on how much memory each apache process might consume. Which in turn depends on what kind of php script it is loading (nextcloud in this instance). Which in turn depends on what nextcloud is doing in that specific request (is it doing some image manipulation in memory or is it just a simple response) .
- Edit
-
If it helps in understanding:
- Each HTTP request is processed by a "worker".
- If you are expecting 100 requests a second, you want 100 workers
- If you configured only 50 workers, then the remaining 50 requests will be queued by apache internally. And process when things workers free up.
- A single nextcloud user can generate any number of requests at any instance. When a user loads a nextcloud dashboard, 100s of things are downloaded. Each thing is a separate request. Same goes for the file syncer. The syncer queries based on requests.
-
Many thanks for the quick help and the detailed explanation.
As I said, the problem occurred when emptying the trash. I assume that many workers are being requested here.
I have increasedMaxRequestWorkers
from 15 to 100 and slightly increased the RAM allocated to the app.
As far as I could test now, the problem seems to be solved. -
-
-