Sunday, January 15, 2012

Return to AB tool

Once I had HAProxy up and running, it was time to do some performance test. I had two things in my mind for this round.

1) Making sure HAProxy is handling configuration changes gracefully, without breaking any existing connections.
2) Comparing the performance of server with and without HAProxy.

Started marching toward first goal. In HAProxy documentation there is a "-sf" option for soft restart. I started AB tool with 50000 request and while AB tool was busy firing those request to HAProxy, I took out one server from proxy setting and restarted the server using -sf option. I noticed AB tool gave me "connection reset by peer error". To understand what is happening and why my server is sending reset package to AB tool, I decided to capture the tcpdump and analyze it in wireshark.

I was surprised that to see that it's AB tool who is sending reset package to server. i.e. if I fired 100 requests using AB tool then I noticed 100 tcp connections with reset flag and 100 with fin, ack flag. Believe me at this point I am totally confused and not sure why the heck AB tool is behaving in such a way. I still don't know. Then I decided to use JMeter. Did similar
exercise and the tcp dump was much cleaner. I noticed only 100 connection with fin,ack flag and no connections in reset mode. Much better.

So started looking to my original issue of dropping connection since JMeter log was also showing connection refused when I tried doing configuration swap. "option redispatch", "option httpchk" and "retries" options saved my day. After specifying these options I was not getting Connection refused any more while doing the changes in the configuration.

One down one more to go. Since I noticed tcp reset flag weirdness with AB tool thought it would be better to use JMeter for second round. Without HAProxy performance of my service was 4500+ req/sec using AB tool. I wanted to capture same thing with JMeter and it reported back 1800+ req/sec.

Ohhh Ohhh. Something wrong again. Started reading about JMeter and found out that JMeter’s HTTP client is slower than that of AB. You can use JMeter to find out if a change to your webapp, your tomcat installation or your JVM, accelerated or slows the response times of the webpage however you cannot use JMeter to determine the server’s maximum number of requests per second that it can successfully serve because of JMeter’s HTTP client appears to be slower than Tomcat’s server code.

So had to come back to my old love AB.
Manisha



No comments:

Post a Comment