Understanding the Meaning of mpm prefork Settings

Asked 1 years ago, Updated 1 years ago, 505 views

I read Apache's official documentation and expert blog about the mpm prefork setting, but I don't understand it very well.
Let me ask you a question about how to think about each setting and how to behave if you do not.

Total requests per site page: about 80 requests
Number of users per minute: 5-10 in peacetime and 15-30 in concentration

The display on one page consists of about 80 requests, most of which are images and requests for js, css.
However, the main document is very heavy and PHP memory_limit requires setting 256MB, which can lead to a response rate of about 1-20 seconds.

mpm_prefork.conf

mpm_prefork.conf (my environment)

I would appreciate it if you could let me know if anyone has any knowledge of the above questions.
Thank you for your cooperation.

ubuntu apache

2023-02-25 07:34

1 Answers

There is a description in Apache's Document.I will reply while quoting.

Apache MPM Common Directives

https://httpd.apache.org/docs/2.4/en/mod/mpm_common.html

From MaxRequestWorkers Directive:
For non-threaded servers (i.e., prefork), MaxRequestWorkers translates into the maximum number of child processes that will be launched to serve requests.

From ServerLimit Directive:
With the prefork MPM, use this direct only if you need to set MaxRequestWorkers higher than 256 (default).

MinSpareServers, MaxSpareServers are settings for the number of waiting servers, so it doesn't make sense in terms of whether the request can be processed.
If the process is insufficient, start the server up to the number of ServerLimit.
If you have a waiting process in place, you can respond immediately without starting the server when you receive a new request, so you should set it up for responsiveness.

MaxConnectionPerChild describes the configuration of a forked server that terminates when the number of connections reaches the configured number:"0" does not terminate no matter how many times you connect.
It seems that it is often set as a countermeasures against memory leaks.(In other words, it is often set in case there is a leak.)

From MaxConnectionsPerChildDirect:
The MaxConnectionsPerChild direct sets the limit on the number of connections that an individual child server process will handle. After MaxConnectionsPerChild connections, the child process will die.
If MaxConnectionsPerChild is 0, then the process will never expire.


2023-02-25 21:04

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.