Skip to content

condy0919/moros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Host OS Build Status
CircleCi Debian 9 CircleCI

moros

moros is a modern HTTP benchmark tool capable of generating significant load even when using single thread.

An optional plugin(using shared library) can perform HTTP request generating, response processing and more on.

Basic

moros http://localhost/a.zip

This runs a benchmark with the following default setting:

threads:        1
connections:    10
duration:       10s
timeout:        2s

Output:

Running 10s test @ http://localhost/a.zip
  1 thread(s) and 10 connection(s) each
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency      0ms        0ms     5ms     99.9979%
    Req/Sec   46.53K      3.23K  51.17K          61%
  473743 requests in 10s, 3.72GB read
Requests/sec: 47374.3
Transfer/sec: 380.56MB

Command Line Options

-p, --plugin:       Load plugin
-H, --Header:       HTTP header
-t, --threads:      The number of HTTP benchers
-c, --connections:  The number of HTTP connections per bencher
-d, --duration:     Duration of the benchmark
-T, --timeout:      Mark HTTP request timeouted if HTTP response is not
                    received within this amount of time
-l, --latency:      Print latency distribution

Tips

Make sure file descriptors is enough. Use ulimit -n unlimitedto handle this.

Installation

Arch Linux

yay -S moros-git

The other can build from source.

morosdepends onboost.program_optionsandopenssllibrary.

Install these 2 packages first.

git clone https://github.com/condy0919/moros

cd moros
git submodule update --init --recursive # nodejs/http-parser

cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
cmake --build build

Themorosbinary will be placed in moros/bin/.

Plugin Interface

  • setup()

    setup begins before the target address has been resolved and all benchers uninitialized.

  • init()

    init begins after each bencher initialized.

  • request(schema, host, port, serivce, query_string, headers[])

    request generates a new HTTP request each time, which is expensive.

    Generating lots of HTTP requests one time and amortizing the cost is a good solution.

  • response(status, headers[], body, body_len)

    response is called with HTTP response status, headers[], body.

    In default, only status is valid.

    Making want_response_headers and want_response_body symbols

    visible in plugin to process headers and body.

  • summary()

    summary can report some data collected in above functions.

TODO

  • follow 302
  • async dns resolve

About

A modern http(s) benchmark tool

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published