{"id":4817,"date":"2018-11-20T03:02:04","date_gmt":"2018-11-20T03:02:04","guid":{"rendered":"https:\/\/geekdecoder.com\/?p=4817"},"modified":"2018-11-20T03:02:04","modified_gmt":"2018-11-20T03:02:04","slug":"benchmark-apache","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2018\/11\/20\/benchmark-apache\/","title":{"rendered":"Benchmark Apache"},"content":{"rendered":"<p>How to test apache.<\/p>\n<p>Create 2 files:<br \/>\ntestload.php<br \/>\ntest.php<\/p>\n<p>Create a php file testload.php that checks the existence of another file named test.php in the same directory of two CentOS 7 servers with the same hardware characteristics and load but with different MPM. One of them will use event and the other one will use prefork.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&lt;!--?php $filename = &#039;test.php&#039;; if (file_exists($filename)) { echo &quot;The file $filename exists&quot;; } else { echo &quot;The file $filename does not exist&quot;; } ?--&gt;\n<\/pre>\n<p>With ab, we will sent 50 (-c 50) concurrent requests at the same time and repeat the test 1000000 times<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\"># ab -c 50 -n 100000 http:\/\/localhost\/testload.php\n<\/pre>\n<p>200 simultaneous requests until 2000 requests are completed:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n# ab -k -c 100 -n 2000 localhost\/testload.php\n\n<\/pre>\n<p>Another test to localhost<br \/>\nPREFORK<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n]# ab -c 50 -n 100000 http:\/\/localhost\/index.html\nThis is ApacheBench, Version 2.3 &lt;$Revision: 1430300 $&gt;\nCopyright 1996 Adam Twiss, Zeus Technology Ltd, http:\/\/www.zeustech.net\/\nLicensed to The Apache Software Foundation, http:\/\/www.apache.org\/\n\nBenchmarking localhost (be patient)\nCompleted 10000 requests\nCompleted 20000 requests\nCompleted 30000 requests\n^C\n\nServer Software:        Apache\/2.4.6\nServer Hostname:        localhost\nServer Port:            80\n\nDocument Path:          \/index.html\nDocument Length:        15167 bytes\n\nConcurrency Level:      50\nTime taken for tests:   3596.808 seconds\nComplete requests:      34570\nFailed requests:        0\nWrite errors:           0\nNon-2xx responses:      34571\nTotal transferred:      537122767 bytes\nHTML transferred:       524331497 bytes\nRequests per second:    9.61 &#x5B;#\/sec] (mean)\nTime per request:       5202.210 &#x5B;ms] (mean)\nTime per request:       104.044 &#x5B;ms] (mean, across all concurrent requests)\nTransfer rate:          145.83 &#x5B;Kbytes\/sec] received\n\nConnection Times (ms)\n              min  mean&#x5B;+\/-sd] median   max\nConnect:        0    0   0.1      0       3\nProcessing:   213 5198 241.5   5203   10154\nWaiting:      174 4428 227.6   4435    9302\nTotal:        214 5198 241.5   5203   10154\n\nPercentage of the requests served within a certain time (ms)\n  50%   5203\n  66%   5264\n  75%   5302\n  80%   5327\n  90%   5391\n  95%   5449\n  98%   5532\n  99%   5617\n 100%  10154 (longest request)\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to test apache. Create 2 files: testload.php test.php Create a php file testload.php that checks the existence of another file named test.php in the same directory of two CentOS 7 servers with the same hardware characteristics and load but with different MPM. One of them will use event and the other one will use &#8230; <a title=\"Benchmark Apache\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2018\/11\/20\/benchmark-apache\/\" aria-label=\"Read more about Benchmark Apache\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-4817","post","type-post","status-publish","format-standard","hentry","category-apache"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4817","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=4817"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4817\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=4817"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=4817"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=4817"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}