https://github.com/condy0919/moros
A modern http(s) benchmark tool
https://github.com/condy0919/moros
benchmark cpp14 http https
Last synced: 9 months ago
JSON representation
A modern http(s) benchmark tool
- Host: GitHub
- URL: https://github.com/condy0919/moros
- Owner: condy0919
- License: mit
- Created: 2018-12-01T00:26:03.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-27T18:03:14.000Z (almost 7 years ago)
- Last Synced: 2025-03-29T06:51:36.459Z (10 months ago)
- Topics: benchmark, cpp14, http, https
- Language: C++
- Homepage:
- Size: 77.1 KB
- Stars: 14
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
|CI |Host OS |Build Status|
|------------|-----------|------------|
|**CircleCi**|Debian 9 |[](https://circleci.com/gh/condy0919/moros)|
# 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
```bash
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 unlimited`to handle this.
## Installation
Arch Linux
```bash
yay -S moros-git
```
The other can build from source.
`moros`depends on`boost.program_options`and`openssl`library.
Install these 2 packages first.
```bash
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
```
The`moros`binary 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