optimize Apache performance mpm_prefork_module - apache

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.

Related

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 mpm in Fedora Linux

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.

How to set mpm prefork for c3.xlarge in ec2 instance

Can any one help me out set apache mpm prefork for 7.5GB RAM and 4Core CPU.
How to calculate mpm parameters ?
Let's say you want to support 8000 concurrent connections in that case you can use below configuration. Where ServerLimit * ThreadsPerChild which in below example is 250 * 32 = 8000
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxClients 8000
MaxRequestsPerChild 10000
</IfModule>

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