0

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 following

Server version: Apache/2.4.6 (CentOS)
Server MPM:     event
5
  • If you want MaxRequestWorkers of 2000, the ServerLimit only needs to be 25. Setting it to 500 may be overpowering your system. See the ServerLimit directive documentation
    – Colt
    Apr 6, 2017 at 11:15
  • You also don't need to start all 80 servers right off
    – Colt
    Apr 6, 2017 at 11:21
  • @Colt could you suggest / optimize my values for high traffic site?
    – Hassaan
    Apr 6, 2017 at 11:54
  • See performance tuning documentation for MaxRequestWorkers formula, and the MPM core and event documentation for other settings
    – Colt
    Apr 6, 2017 at 12:20
  • @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
    Apr 6, 2017 at 12:31

1 Answer 1

2

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.

15
  • Thank 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 hit ab -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
    Apr 6, 2017 at 20:35
  • Do I need other setting like EnableSendfile or KeepAlive connections to increase performance ?
    – Hassaan
    Apr 7, 2017 at 5:13
  • If your static content is not on a networked filesystem you can use EnableSendFile, KeepAlive, yes I usually allow around 80% of maxrequestworkers, but that's just me probably. Try ab from a different machin (not locally) otherwise you are adding the overhead of the calls to the overhead of the responses and also, try requesting static content first (index.html or hello.gif, etc), not dynamic content such as cgi scripts/php since then performance will depend on the scripts performance not apache itself. Apr 7, 2017 at 12:30
  • I would also encourage to upgrade from 2.4.6 , it's quite an old version. Apr 7, 2017 at 12:32
  • Does these improve performance, if yes then can you update your answer accordingly KeepAlive On KeepAliveTimeout 5 MaxKeepAliveRequests 128
    – Hassaan
    Apr 7, 2017 at 12:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .