Giter Site home page Giter Site logo

traffic-replayer's Introduction

This is a Clojure program designed to realistically replay HTTP GET requests from a log file to the server of your choice. By "realistically", I mean it does its best to ensure that requests are made in the order they originally arrived, and at a similar rate.

Why another load testing tool? I had trouble finding something that could take an existing log file and generate similar traffic patterns based off its timestamps, and I wanted something that didn't rely on a whole bunch of threads for concurrency (this tool uses NIO to fire many requests from a single thread).

Building it

The usual steps:

  1. Get Leiningen from http://github.com/technomancy/leiningen and put the 'lein' script somewhere in your $PATH.

  2. Run 'lein uberjar'. Lein will grab all required dependencies and produce a 'traffic-replayer-[VERSION].jar'.

Using it

Using this program is a two step process: you generate a script file (containing URLs requested and timing information), and then you replay it at a specified host.

Generating a script file

You could do this yourself using Perl/sed/awk/whatever, but this program does know how to generate script files from HAProxy logs. The script file format is just:

[ms since epoch]\t[requested URI (e.g. /foo)]

Lines must be sorted numerically by the timestamp (e.g. sort -n -k1).

To generate a script file from a HAProxy log, I used:

$ grep 'GET /some/url' ~/some.log.2010-07-19 | \
    java -jar traffic-replayer-[VERSION].jar generate /dev/stdin script.out

HaProxy logs work well because they log the time the request was received, as well as the time it completed (many servers only log the latter, which is less useful for this sort of thing).

Replaying a script file

Replay a script file is similar:

# To replay traffic against http://localhost/someprefix
#
$ java -jar traffic-replayer-[VERSION].jar replay script.out http://localhost/someprefix run.log

On the console you'll see timing information ("sleeping NNN ms before next request"). In your run.log you'll see each URL that has been requested and how long it took to come back.

traffic-replayer's People

Contributors

marktriggs avatar

Stargazers

Dinesh Appavoo avatar Adam Stallard avatar Dave Konopka avatar Brian Tingle avatar  avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

gonzih

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.