GithubHelp home page GithubHelp logo

rath / http-replay-bench Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 656 KB

Http Benchmark Tool with recorded parameters and headers

Home Page: http://xrath.com/2010/01/http-replay-bench-was-released/

License: MIT License

Java 100.00%

http-replay-bench's Introduction

==============================================
  HTTP Benchmark tool with captured requests
==============================================

Author
-------------
Jang-Ho Hwang, [email protected]


What is this?
-------------
A benchmark tool to replay all http-requests which are captured in a real 
environment, not a fake one. We have to test our web applications with good 
and even bad parameters or headers. In many cases, we cannot expect most kinds 
of requests that are sent by users. As a result, we usually do test in a small 
boundary, and will see a sort of bugs in a real environment. 

With replay benchmark tool, you can capture users' http-request to file system.
then, can test your modified web application with captured requests. 



Requirement
-------------
Java Standard Edition 6 or greater version.


Usage
-------------
java -jar rb.jar -d samples -c 100 -n 20000 http://myservice.com/


Expected result
---------------
Number of sent requests
2,000,000

Total time to consume
06h 21m 10s

                  min     avg      max
Response time     3ms   260ms    822ms

Response codes     
OK        200:      1,883,293  ( 94.16%)
Moved     302:         17,382  (  0.86%)
Forbidden 403:          1,238  (  0.06%)
Not found 404:              0  (  0.00%)
Error     500:        103,290  (  5.16%)
Death     503:            383  (  0.01%)


Options
-----------
d : A directory pathname that includes captured http-requests in file formats. 
    This file is generated by rb-capture-plugin.jar.

c : concurrency. number of multiple requests to replay at a time. Default is one
    request at a time. The default implementation is built with n-thread. 

n : Number of requests to replay for benchmarking session. this number is 
    belong to each thread to replay http-requests.


Format of Captured Requests
---------------------------
Captured requests are stored with Java Object Serialization. A sequence of 
java.util.Map objects. These maps are not stored in java.util.List. Instead,
each map have its own stream header. Following is a code snippet which is 
intended to capture a series of http-requests. 

  FileOutputStream fos = new FileOutputStream(String.format(
    "captured-%d.log", Thread.currentThread().getId()), true);

  ObjectOutputStream oos = new ObjectOutputStream(fos); 
  oos.writeObject(*a-http-request*);
  oos.flush();

  fos.close();

A http-request is a java.util.Map object which includes following attributes. 

  REMOTE_ADDR  : a IP in String. but not be used in this benchmark tool.
  METHOD       : HTTP Method in String . it can be GET, POST, DELETE, PUT.
  HEADERS      : a Map which is includes all HTTP request headers. Its generic
                 type is Map<String, String>. This attributes are useful 
                 when you want to test in gzip/deflate request.
  REQUEST_URI  : a URI in String. Be careful that this value doesn't include
                 querystring even in GET method.
  PARAMETERS   : a Map which is stored all parameters included in a request. 
                 Its generic type is Map<String, Object>. the format of a 
                 value is generally String and can be String[].
  TIMESTAMP    : timestamp when this request was sent that represented by Long.


Install rb-capture-plugin.jar into your web application
---------------------------------------------------
1) copy rb-capture-plugin.jar into WEB-INF/lib
2) Open web.xml file and append below block.

  <filter>
    <filter-name>request-capture</filter-name>
    <filter-class>com.xrath.benchmark.http.plugins.RequestCaptureFilter</filter-class>
    <init-param>
      <param-name>output-directory</param-name>
      <param-value>/tmp</param-value>
    </init-param>
  </filter>
  
  <filter-mapping>
    <filter-name>request-capture</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

3) Done! 


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.