apache mpm in Fedora Linux - apache

What is ideal configuration of apache - Prefork or Worker in Fedora Linux run on 8 core cpu with 60gb RAM for heavy traffic sites, Currently configured in httpd.conf -
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 3500
MaxClients 3500
MaxRequestsPerChild 40000
</IfModule>
<IfModule worker.c>
StartServers 4
MaxClients 3500
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 40000
</IfModule>
Currently prefork is active.

Webservers do not scale well. Unless you have a very unusual workload you will get better throughput and capacity and much, much more resillience out of 2 servers with 2 cores and 8Gb of RAM than this box - but a lot depends on what your workload looks like and what else is running on the machine.
If you have a look around the site you'll see that questions about capacity planning are closed as being too broad, or moved to serverfault (where they are closed as duplicates to a question where there is no definitive answer).
Hence the answer is to measure what traffic your hardware can cope with and set the limits accordingly.

Related

optimize Apache performance mpm_prefork_module

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.

apache httpd high cpu 100% on centos 6.8

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 ^^.

MaxRequestWorkers setting

I have a vps with Ubuntu 14.04.1 LTS and plesk 12.01
Where I have 8 active domains.
Many times I find myself off the http service logs the following error:
server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
<IfModule mpm_event_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 150
MaxConnectionsPerChild 0
</IfModule>
I tried different configurations, but nothing.
Just start the apache service sites go quietly, after 2-3 minutes they all go off. But the cpu and ram are completely free.
In plesk I only active mpm_prefor
How can I fix this?
Can you please try to increase MaxRequestWorkers value on your server to 250 and monitor your Apache services logs, if you are getting same issues that meas your server is under DDOS attack and due to that you are getting this issues,

Apache Configuration Tuning

I need to tune my apache2 Config to handle 1500 Connections simultaneously. Each request user makes it never ends and he gets data all the time except if he press the stop from his browser.
My Current Config Is:
<IfModule mpm_prefork_module>
StartServers 15
MinSpareServers 5
MaxSpareServers 50
ServerLimit 5000
MaxClients 5000
MaxRequestsPerChild 4000
</IfModule>
<IfModule mpm_worker_module>
ServerLimit 40
StartServers 2
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
Which i have no idea if this is tuned. Also do i need to tune something else other tan prefork_module and worker module?
Please note that the server is really strong with 12 Cores and 64GB Ram.
Thank you

httpd memory release is slow

I am using httpd with mod jk 1.2.28 on RHEL5.
Behind httpd, I do have tomcat running. Connection from httpd to tomcat is made via ajp connector using modjk.
I am just load testing the httpd - Using JMeter, when I create 2000 users in 120 seconds from two different JVMs simultaneously, the httpd memory usage goes high and when all the connections are released slowly, the httpd memory release is very slow. Sometime I do need to restart httpd process. When I restart httpd, memory usage immediately goes down.
What should I do to speed up httpd memory release without restarting httpd process ?
Is there any attribute for achieving this in workers.properties and httpd.conf ?
Please provide some help.
Thanks in advance :)
One interesting observation of mine -
With low value say 200 of maxThread in tomcat server.xml, httpd becomes unresponsive and I need to restart httpd after running my jmeter load test. Memory is not released automatically after the test completes
connections on 8009 are CLOSE_WAIT
With high value say 2000 of maxThread in tomcat server.xml, no need to restart httpd after running JMeter load test, As Memory is released automatically after the test completes
Connections on 8009 are LAST_ACK
My httpd.conf is as follows. I do not understand which of these two MPMs is used. Accordingly I need to modify MaxClient value. Please help I do not want to restart httpd and I dont want high value for maxThread.
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>