Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to replay traffic to web server from logs to profile / benchmark web app under real load?

Is there a way to get recorder real network traffic to web server, e.g. from web server logs (Apache), and replay this traffic to either profile web application (in Perl) under real load, or benchmark and compare speed of different implementations before choosing one or the other?

If it matters, webapp is written in Perl, and runs under plain CGI, FastCGI, mod_perl (via ModPerl::Registry), PSGI (via Plack::App::WrapCGI).

Crossposted to Pro Webmasters


Similar questions on Server Fault:

  • How can I replay Apache access logs back at my servers to do real world load testing?
like image 409
Jakub Narębski Avatar asked Nov 07 '10 15:11

Jakub Narębski


2 Answers

A quick scan on Google for this yielded an interesting blog entry with subsequent, useful comments are at http://www.igvita.com/2008/09/30/load-testing-with-log-replay/. A commenter also mentioned Tsung by Process-One that allows for recording sessions real-time, with the obvious note that you should be able to replay it back. That doesn't help so much with existing Apache access logs though.

like image 64
zerolagtime Avatar answered Nov 01 '22 14:11

zerolagtime


Been here lately. I figured that if I dumped tcp traffic with tcpdump I could rewrite the destination of the packages and then replay it to the new app servers. So I started out with something like this:

tcpdump -i eth1 dst -s 0 -w - port 80 | \
tcprewrite --mtu-trunc --infile=- --outfile=- \
--dstipmap=<source_ip>:<destination_ip> | \
tcpslice -w - - | tcpreplay --intf1=eth1 -

It did not work for various reasons, so I started digging some more and found Gor: a small Go project by Leonid Bugaev from Granify, written for exactly what we wanted to accomplish here.

This is how we ended up using Gor: http://devblog.springest.com/testing-big-infrastructure-changes-at-springest/

We have a Chef cookbook for it as well: https://github.com/Springest/gor-chef

Hope this helps.

like image 34
wrdevos Avatar answered Nov 01 '22 13:11

wrdevos