1

I have found so many stuff related to Apache worker MPM is working fast than Prefork MPM, i know nginx is another option but i want to stick on apache as for use of htaccess and some other features, so i am doing a comparison using apache benchmark testing to serve static content (bg.png) file (size=232KB) and i surprised to see results that apache prefork serving static content faster than worker, the difference is not so big, but the results put me in doubt and i am not taking a decision on below tests, so please guide and help me.

Both tests are done on same server using loopback interface (127.0.0.1) localhost to avoid doubts related to network / bandwidth delays and also without keep alive.

1) Test using apache prefork

prefork MPM

StartServers 5 MinSpareServers 3 MaxSpareServers 5 ServerLimit 256 MaxClients 256 MaxRequestsPerChild 4000

ab -n 1000 -c 900 http://localhost/bg.png

Document Path: /bg.png Document Length: 235354 bytes

Concurrency Level: 900 Time taken for tests: 1.053 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 235983024 bytes HTML transferred: 235738292 bytes Requests per second: 949.68 [#/sec] (mean) Time per request: 947.690 [ms] (mean) Time per request: 1.053 [ms] (mean, across all concurrent requests) Transfer rate: 218855.25 [Kbytes/sec] received

Connection Times (ms) min mean[+/-sd] median max Connect: 0 111 295.5 1 1000 Processing: 3 137 207.8 59 631 Waiting: 0 136 208.1 58 631 Total: 22 248 334.4 73 1024

Percentage of the requests served within a certain time (ms) 50% 73 66% 79 75% 660 80% 664 90% 672 95% 1019 98% 1022 99% 1023 100% 1024 (longest request)

2) Test using Worker MPM

ThreadLimit 200 StartServers 3 ServerLimit 25 MaxClients 2000 MinSpareThreads 50 MaxSpareThreads 200 ThreadsPerChild 100 MaxRequestsPerChild 0

Document Path: /bg.png Document Length: 235354 bytes

Concurrency Level: 900 Time taken for tests: 1.061 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 264421004 bytes HTML transferred: 264146992 bytes Requests per second: 942.39 [#/sec] (mean) Time per request: 955.018 [ms] (mean) Time per request: 1.061 [ms] (mean, across all concurrent requests) Transfer rate: 243347.56 [Kbytes/sec] received

Connection Times (ms) min mean[+/-sd] median max Connect: 0 58 158.4 37 1003 Processing: 31 255 330.6 88 884 Waiting: 0 223 336.7 50 870 Total: 68 313 354.1 112 1034

Percentage of the requests served within a certain time (ms) 50% 112 66% 150 75% 900 80% 905 90% 920 95% 921 98% 1032 99% 1033 100% 1034 (longest request)

Below are the differences

Prefork stats

Time taken for tests: 1.053 seconds Total transferred: 235983024 bytes HTML transferred: 235738292 bytes Requests per second: 949.68 [#/sec] (mean) Time per request: 947.690 [ms] (mean) Time per request: 1.053 [ms] (mean, across all concurrent requests) Transfer rate: 218855.25 [Kbytes/sec] received

worker stats

Time taken for tests: 1.061 seconds Total transferred: 264421004 bytes HTML transferred: 264146992 bytes Requests per second: 942.39 [#/sec] (mean) Time per request: 955.018 [ms] (mean) Time per request: 1.061 [ms] (mean, across all concurrent requests) Transfer rate: 243347.56 [Kbytes/sec] received

so as per above stats

Time taken for tests + Time per request is less for prefork then worker. So please guide & suggest, is prefork is best for serving static content ??

Mike
  • 11
  • 1

0 Answers0