In my previous blog post “Refactoring without good test coverage” I mentioned using Shadow Stress Test at Reevoo - real time stress testing under live mirrored traffic. Therefore we are able to test new code with real clients traffic without affecting clients.
Our production servers hosted at Amazon EC2 allow us to create a snapshot of server instance.
One of our live instances configured to send a copy of live traffic into copied (shadow) instance.
To do this, we decided to use EM-Proxy gem (EventMachine Proxy DSL).
Current flow is:
Production server redirecting live traffic from interface eth0 and port 80 to port 8001;
Defining shadow and production server connections (production as localhost, instead of eth0 to not introduce a loop);
Setting connection as closed;
On response - setting up a response code from shadow and production servers;
Calculating a response time;
Writing stats as STDOUT into file;
Logstash parsing this file.
This is our em-proxy configuration file:
Using various filters in Kibana (browser based analytics and search interface to Logstash) we are able to compare response code and response time from production and shadow servers.
For example you can see on the graph - response code breakdown.
Later you can filter traffic with response code 200 from production and not 200 from shadow to identify the difference, especially if you legacy application does not have a good test coverage.