0

I've configured Apache web server on my CentOs sever machine. I want to increase 5000 concurrent request with MPM_Prefork. Please suggest best Prefork configuration for that. I've done Prefork configuration on httpd.conf file, but its not working.

My Prefork configuration:

<IfModule mpm_prefork_module>
      StartServers                5
      MinSpareServers             30
      MaxSpareServers             40
      MaxClients                  5000
      ServerLimit                 20
      MaxRequestsPerChild         500 
</IfModule>

      KeepAlive       On 
      MaxKeepAliveRequests  5000  
      KeepAliveTimeout       5
HBruijn
  • 72,524
  • 21
  • 127
  • 192
harshu9713
  • 25
  • 2
  • 6
  • If you have sufficient RAM you should probably start by increasing the value of the [`ServerLimit`](https://httpd.apache.org/docs/2.4/mod/mpm_common.html#serverlimit) and define the [`MaxRequestWorkers`](https://httpd.apache.org/docs/2.4/mod/mpm_common.html#maxrequestworkers). – HBruijn Oct 25 '17 at 05:11
  • Thanks for your reply.....What should be the value of ServerLimit for 5000 concurrent requests. I've 16 GB RAM on my server. Is MaxRequestWorker & MaxClients are the different parameters??? – harshu9713 Oct 25 '17 at 05:16
  • I've increased ServerLimit to 5000. But not getting 5000 requests... – harshu9713 Oct 25 '17 at 08:23
  • It has been ages since I used apache 2.2 so I had forgotten that MaxClients is the old, deprecated, but still allowed, directive for MaxRequestWorkers. How are you benchmarking and are you benchmarking with static files or requesting dynamic resources and could it be that it is not apache, but for instance your code/database connection that is the bottleneck? Also when benchmarking, note that it takes a while for Apache to spin up enough workers to handle load; check the process creation section on: https://httpd.apache.org/docs/2.4/misc/perf-tuning.html - Do you see anything in your error_log – HBruijn Oct 25 '17 at 08:39

1 Answers1

1

How can I support 5000 concurrent requests with mpm_prefork on Apache?

You probably don't.

The prefork MPM is a bad choice for a site that has to handle many simultaneous connections. It uses multiple child processes with one thread each. Each process handles one connection at a time.

For 5000 concurrent connections, you'll need to run 5000 httpd processes...
You will need to check how much memory each httpd process consumes for your configuration, but even with a modest 10 MB per process and not running anything else you will run out of your 16 GB of RAM well before you hit 5000 httpd processes.

HBruijn
  • 72,524
  • 21
  • 127
  • 192