I would like to change the default max connection numbers in Apache as the number of processes is now
# ps -ef | grep apache2 | wc -l
152
I have read that I have to change ServerLimit, but I don't see that in apache config files.
# grep -r ServerLimit .
#
Where should I apply that?
UPDATE:
Regarding the MPM module, I see this in mods-available/mpm_prefork.conf:
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
Should I increase MaxRequestWorkers only? Or I have to define ServerLimit?
MPM configuration setting located in conf.modules.d/00-mpm.conf file. You can configure ServerLimit after LoadModule entry. You can refer httpd process always 256
Related
I have a VPS server that sometimes stop Apache2 because its settings are not well seized
Service specifications:
RAM 30
CPU 8
I tried to seize it myself, but I did not succeed
The current settings:
<IfModule mpm_prefork_module> StartServers 100 MinSpareServers 20 MaxSpareServers 50 ServerLimit 4000 MaxClients 1400 MaxRequestWorkers 8000 MaxConnectionsPerChild 10000 MaxRequestsPerChild 5000 KeepAlive 0 </IfModule>
Can you give me the best settings that suit the server specifications, knowing that it receives huge requests
mod_prefork is an old module.
I advise you to use mod_event or mod_worker these module are clearly better.
You can see more information here explanation.
About your configuration, it’s depend on you server software stack.
If you have only Apache with maybe a Php webapp or other.
I think you can use this profile, of course with monitoring you can configure it better that my estimation.
StartServers 8
MinSpareServers 10
MaxSpareServers 40
KeepAlive 0
ServerLimit 1500
MaxRequestWorkers 1500
MaxConnectionsPerChild 4000
MaxRequestWorkers and MaxClients is the same directive, MaxClients is the old version.
MaxRequestsPerChild and MaxConnectionsPerChild is the same too, MaxRequestsPerChild is the old version.
Im trying to use mpm event for a website that has a lot of request at the same time.
changing the configuration in apache produced an error and the page is not displayed
On centos 7 and Apache 2.4 installed
change the configuracion /etc/httpd/conf/httpd.conf
1-uncomment
LoadModule mpm_event_module modules/mod_mpm_event.so
2- then restart server
systemctl restart httpd
3- Add this configuration on /etc/httpd/conf/httpd.conf
<IfModule mpm_event_module>
StartServers 3
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 30
MaxConnectionsPerChild 1000
</IfModule>
Is missing some configuration or installation of a module for php for MPM EVENT to work?
I'm using apache 2.2 on centos 6.8. Sometime some httpd process used 100% as image below:
Top monitoring
I already checked all website's source code and all of them is ok ( no loop, no error, ... ).
and httpd.conf:
Timeout 30
KeepAlive Off
<IfModule worker.c>
StartServers 8
MaxClients 1000
MinSpareThreads 8
MaxSpareThreads 100
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
RLimitCPU 60 80
but I can not find any reason about that issue, pls help, thank so much ^^.
I am trying to tune my AWS apache server. I have looked in:
$: httpd/conf/httpd.conf
And I cannot find this section to edit:
<IfModule prefork.c>
StartServers 10
MinSpareServers 10
MaxSpareServers 25
ServerLimit 128
MaxClients 128
MaxRequestsPerChild 0
</IfModule>
Where will I find the above settings if they are not in: httpd/conf/httpd.conf
Be sure the prefork module is enabled ( Unless you disabled it, it's enabled by default ).
The section you're looking for is in the prefork configuration file, which is in this case, in the enabled modules directory:
/etc/apache2/mods-enabled/mpm_prefork.conf
It depends on how apache was compiled. If apache was compiled with mod_event instead of prefork that section might not exist in the apache httpd.conf file. On redhat/centos distros the default location for httpd.conf file is in /etc/httpd/conf. On debian/ubuntru distros you will find httpd.conf in /etc/apache2
There are multiple factors which impact apache performance.
Tune JVM
Log rotation policy
Tune linux kernal parameters
Tune apache MPM
I assumed you have done first 3 steps and want to understand about 4th.
Step 4. check which MPM your are using with command:
[root#mohitm ~]# apachectl -V|grep "Server MPM:"
Server MPM: prefork
[root#mohitm ~]#
To locate the httpd config file
$ /usr/sbin/apache2 -V | grep SERVER_CONFIG_FILE
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"
#
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 16
MinSpareServers 10
MaxSpareServers 20
ServerLimit 5024
MaxClients 5024
MaxRequestsPerChild 10000
</IfModule>
#
The Apache main configuration file on Amazon Linux:
/etc/httpd/conf/httpd.conf
Other configuration loaded files:
- conf.modules.d/*.conf
- conf.d/*.conf
I could not find section, then i´ve added to the main file and solve my problem.
I have updated /etc/httpd/conf/httpd.conf file of elastic beanstalk instance with this.
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 1000
MaxClients 1000
MaxRequestsPerChild 4000
</IfModule>
After that i restarted my httpd service using
sudo service httpd restart
Now if i have 300 clients running at a time, then apache is still throwing this error.
[error] server reached MaxClients setting, consider raising the MaxClients setting.
What should i do to update maxclients setting effectively?
Try this or this or this. I have not yet tried this practically . you can try it out .