<p>Ben testlerimde kali linux kullanmayı tercih ediyorum , debian tabanlı olması işimi de kolaylaştırıyor. Gnuplot eğer kullandığınız dağıtımda yok ise <span style="color: #ff0000;">apt-get install gnuplot</span> şeklinde kurulum yapabilirsiniz.</p>
<p>Şimdi örneğimizde bir siteye ab test yapacağız , Aşağıdaki komut baz alındığında açıklaması kısaca şöyle , ben ayhanarda.com a doğru eş zamanlı 10 istek şeklinde toplam 500 istek göndereceğim. Sonucunu da ardatest.data dosyasına yazacağım. (tabi Siz benim siteme doğru test yapmayın lütfen :)</p>
<p>root@ayhanarda-kali:~# <span style="color: #ff0000;">ab -n 500 -c 10 -g ardatest.data http://www.ayhanarda.com/</span><br />
This is ApacheBench, Version 2.3 <;$Revision: 1604373 $>;<br />
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Licensed to The Apache Software Foundation, http://www.apache.org/</p>
<p>Benchmarking www.ayhanarda.com (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Finished 500 requests<br />
Server Software: LiteSpeed<br />
Server Hostname: www.ayhanarda.com<br />
Server Port: 80</p>
<p><!--more--></p>
<p>Document Path: /<br />
Document Length: 1147 bytes</p>
<p>Concurrency Level: 10<br />
Time taken for tests: 2.158 seconds<br />
Complete requests: 500<br />
Failed requests: 0<br />
Non-2xx responses: 500<br />
Total transferred: 683500 bytes<br />
HTML transferred: 573500 bytes<br />
Requests per second: 231.65 [#/sec] (mean)<br />
Time per request: 43.169 [ms] (mean)<br />
Time per request: 4.317 [ms] (mean, across all concurrent requests)<br />
Transfer rate: 309.24 [Kbytes/sec] received</p>
<p>Connection Times (ms)<br />
min mean[+/-sd] median max<br />
Connect: 15 17 1.8 18 25<br />
Processing: 18 25 15.6 21 132<br />
Waiting: 18 25 13.9 21 113<br />
Total: 33 43 15.7 39 150</p>
<p>Percentage of the requests served within a certain time (ms)<br />
50% 39<br />
66% 41<br />
75% 43<br />
80% 45<br />
90% 51<br />
95% 55<br />
98% 128<br />
99% 147<br />
100% 150 (longest request)</p>
<p>Muhtemelen komut sonunda buna benzer bir çıktı alacaksınız , anlamlandırması karşışık olduğu için grafik üretmeyi tercih ediyoruz.</p>
<p>Şimdi favori editor ünüz ile apache-benchmark.p isimli dosyayı aşağıdaki örnekteki gibi düzenleyeceğiz. Muhtemel apache benchmark testi yapan birisi zaten kolaylıkla anlamlandırabilecektir. set output ile oluşacak png dosyasının adını belirliyoruz ,satır ve sütun a isim veriyoruz , hangi apachebenchmark çıktı dosyasını kullanacağımızı belirtiyoruz , herşey tamam ise kaydedip çıkıyoruz.</p>
<p>root@ayhanarda-kali:~# <span style="color: #ff0000;">nano apache-benchmark.p</span></p>
<p># output as png image<br />
set terminal png</p>
<p># save file to &#8220;benchmark.png&#8221;<br />
set output &#8220;benchmark.png&#8221;</p>
<p># graph title<br />
set title &#8220;ab -n 500 -c 10 -g ardatest.data http://www.ayhanarda.com/&#8221;</p>
<p>#nicer aspect ratio for image size<br />
set size 1,0.7</p>
<p># y-axis grid<br />
set grid y</p>
<p>#x-axis label<br />
set xlabel &#8220;istek&#8221;</p>
<p>#y-axis label<br />
set ylabel &#8220;yanit suresi (ms)&#8221;</p>
<p>plot &#8220;ardatest.data&#8221; using 9 smooth sbezier with lines title &#8220;something&#8221;<br />
#Ayhan ARDA &#8211; Apache Benchmark</p>
<hr />
<p>Aşağıdaki komut ile grafiğimizi oluşturabiliriz.</p>
<p>root@ayhanarda-kali:~# <span style="color: #ff0000;">gnuplot apache-benchmark.p</span></p>
<p>Şimdi benchmark.png dosyamız hazır , benim örneğimde aşağıdaki gibi oluştu.</p>
<p><a href="http://www.ayhanarda.com/blog/wp-content/uploads/2016/08/benchmark-e1470209387803.png"><img class="aligncenter size-full wp-image-1116" src="http://www.ayhanarda.com/blog/wp-content/uploads/2016/08/benchmark-e1470209387803.png" alt="apache benchmark gnuplot" width="622" height="331" /></a></p>
<p>Ayhan ARDA</p>