Apache MaxRequestWorkers issue not resolving
ServerLimit is not defined/not read, but still that value you want to try makes no sense since threads per child is already forcing the serverlimit to 80.
And why do you use so small number of threads? You are generating too many child processes without need, probably making Apache less performant in the process (spawn processes more expensive than threads)
Note: MPM settings require a FULL STOP/START (not restart).
Set this.
StartServers 1
ServerLimit 4
MinSpareThreads 500
MaxSpareThreads 1500
MaxRequestWorkers 2000
ThreadsPerChild 500
ThreadLimit 500
MaxConnectionsPerChild 0
MaxKeepAliveRequests 1500
KeepAlive On
KeepAliveTimeout 10
And do make sure you do a full stop then start for the changes to be applied for real.
Related videos on Youtube
Hassaan
Updated on September 18, 2022Comments
-
Hassaan over 1 year
My website generate when I tried to hit 1000 requests per second on it. I am seeing the following errors in my apache logs
Apr 06 00:00:33 ns503772******100.net httpd[9585]: AH00515: WARNING: MaxRequestWorkers of 2000 would require 80 servers and Apr 06 00:00:33 ns503772******100.net httpd[9585]: would exceed ServerLimit of 16, decreasing to 400. Apr 06 00:00:33 ns503772******100.net httpd[9585]: To increase, please see the ServerLimit directive.
My current setting was following
<IfModule mpm_event_module> LoadModule cgid_module modules/mod_cgid.so MaxRequestWorkers 2000 </IfModule>
I'm am using Plesk Onyx and server specification are following.
Processor: Intel Xeon E5-1620v2 - 4c/8t - 3.7 GHz/3.9 GH
Sever Ram: 64GB DDR3
Then I have tried the following settings
<IfModule mpm_event_module> StartServers 80 MinSpareThreads 50 MaxSpareThreads 300 ThreadLimit 25 ThreadsPerChild 25 ServerLimit 500 MaxRequestWorkers 2000 MaxConnectionsPerChild 0 </IfModule>
but issue remain un solved, infarct its generating more errors & log-writer started eating CPU
output of
httpd -V | grep -i 'version\|mpm'
is followingServer version: Apache/2.4.6 (CentOS) Server MPM: event
-
Admin about 7 yearsIf you want
MaxRequestWorkers
of 2000, theServerLimit
only needs to be 25. Setting it to 500 may be overpowering your system. See the ServerLimit directive documentation -
Admin about 7 yearsYou also don't need to start all 80 servers right off
-
Admin about 7 years@Colt could you suggest / optimize my values for high traffic site?
-
Admin about 7 yearsSee performance tuning documentation for
MaxRequestWorkers
formula, and the MPM core and event documentation for other settings -
Admin about 7 years@Colt I have tried it but results are not good. I have write the conf I have tried in my question. I think performance tuning need experience so I am asking to help me out please
-
-
Hassaan about 7 yearsThank you so much for response. Yeah actually I don't much knowledge and experience in performance tuning of
apache 2.4
. I have applied your suggested setting and things seem OK but When I hitab -n 100000 -c 500 http://www.4songs.pk/
command to test server, my site works to slow. I have good processor and ram. What do you suggest is these setting are OK? -
Hassaan about 7 yearsDo I need other setting like
EnableSendfile
orKeepAlive connections
to increase performance ? -
ezra-s about 7 yearsI would also encourage to upgrade from 2.4.6 , it's quite an old version.
-
Hassaan about 7 yearsyes I want to upgrade this one but I affair it does not support working because
yum update
does not show new version of apache. -
ezra-s about 7 yearstoo small number of maxkeepalive if you want to allow a max of 2000 workers imo, try the 80% rule.
-
ezra-s about 7 yearsthere you have it.
-
Hassaan about 7 yearsThank you. I read somewhere
KeepAlive
KeepAliveTimeout
MaxKeepAliveRequests
are not used onMPM Events
is this true? -
ezra-s about 7 yearsno, that's false
-
Hassaan about 7 yearsThank you, Can you help me out with this one serverfault.com/questions/843460/…
-
Hassaan about 7 yearsYou can you please update your answer according to 5000
MaxRequestWorkers
setting -
Hassaan about 7 yearsYou are expert in apache and I think you can help me out better