Question: 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](https://webmasters.stackexchange.com/questions/5146/how-to-replay-traffic-to-web-server-from-logs-to-profile-benchmark-web-app-unde)*

---

Similar questions on Server Fault:

* [How can I replay Apache access logs back at my servers to do real world load testing?](https://serverfault.com/questions/84041/how-can-i-replay-apache-access-logs-back-at-my-servers-to-do-real-world-load-test)

Answer: 
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](http://tsung.erlang-projects.org/) 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.
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.