Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Alternatives to ApacheBench for profiling my code speed

I've done some experiments using Apache Bench to profile my code response times, and it doesn't quite generate the right kind of data for me. I hope the good people here have ideas.

Specifically, I need a tool that

  • Does HTTP requests over the network (it doesn't need to do anything very fancy)
  • Records response times as accurately as possible (at least to a few milliseconds)
  • Writes the response time data to a file without further processing (or provides it to my code, if a library)

I know about ab -e, which prints data to a file. The problem is that this prints only the quantile data, which is useful, but not what I need. The ab -g option would work, except that it doesn't print sub-second data, meaning I don't have the resolution I need.

I wrote a few lines of Python to do it, but the httplib is horribly inefficient and so the results were useless. In general, I need better precision than pure Python is likely to provide. If anyone has suggestions for a library usable from Python, I'm all ears.

I need something that is high performance, repeatable, and reliable.

I know that half my responses are going to be along the lines of "internet latency makes that kind of detailed measurements meaningless." In my particular use case, this is not true. I need high resolution timing details. Something that actually used my HPET hardware would be awesome.

Throwing a bounty on here because of the low number of answers and views.

like image 777
Paul McMillan Avatar asked Nov 03 '10 01:11

Paul McMillan


People also ask

What is ApacheBench command line utility?

ApacheBench ( ab is the real program file name) is a single-threaded command line computer program used for benchmarking (measuring the performance of) HTTP web servers.

What does Apache benchmark do?

ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving.


1 Answers

I have done this in two ways.

With "loadrunner" which is a wonderful but pretty expensive product (from I think HP these days).

With combination perl/php and the Curl package. I found the CURL api slightly easier to use from php. Its pretty easy to roll your own GET and PUT requests. I would also recommend manually running through some sample requests with Firefox and the LiveHttpHeaders add on to captute the exact format of the http requests you need.

like image 196
James Anderson Avatar answered Nov 10 '22 01:11

James Anderson