In these article we gonna learn How to capture your Real Time traffic from production and reuse it at your testing/development environment.
Prerequisite:
One web server running, or If you are just playing around then you can run goreplay test ftp server.
Let's Begin
Load Testing for site serving millions user wasn't be that easy before I came to know GoReplay. Here I am not gonna explain you How great go replay is, You will automatically get to know after following steps above step to capture and replay your request logs. FYI GoReplay capture logs from tcpdump.
Installation:
Download zip file from there git repo and unzip it.
#create a directory
mkdir ~/goreplay
#go to directory you created
cd ~/goreplay
#download tar file from goreplay git repo
wget https://github.com/buger/goreplay/releases/download/v0.16.1/gor_0.16.1_x64.tar.gz
#unzip it
tar -xf gor_0.16.1_x64.tar.gz
Capture Request:
It will basically capture request coming on port 80 on that server.
sudo ./goreplay --input-raw :80 --output-file filename --exit-after 5m
This command will basically capture request coming on port 80 and store that data into filename and will stop capturing after 5 minutes.
Replay Request:
It will basically replay same traffic on testing machine.
sudo ./goreplay --input-file filename --output-http "http://domain.com/"
This command will basically hit request that's already stored in filename to given http domain.
Conclusion:
Yes, I told to you Testing your development site with actual production requests wasn't that easy.
For Further Reading, please check following Links
GoReplay Documentation
https://github.com/buger/goreplay/wiki/Getting-Started
A Blog on medium by Leonid Bugaev
https://leonsbox.com/goreplay-v0-16-and-4th-anniversary-5408b1fd72e0
Comments
Post a Comment