Skip to main content

Surcharge is a tool for benchmarking your web serve

Project description

Surcharge
========

`Surcharge` is a tool for benchmarking your web server like `apache benchmark`.

Surcharge uses the `gevent` networking library. Using the `greenlets` allow to spawn many concurrent requests with little memory.

HTTP requests are made with `requests` library.




Example
=======
```bash
# simple call
$ python surcharge.py --numbers 10 --concurrency 5 http://google.com

Server: gws
URL: http://google.com
Concurrency level: 5
Options: {}

[----------]

Number process requests: 10
Time taken for tests: 5.91

Complete requests: 10
Failed requests: 0

Faster request: 0.464
Slower request: 5.443
Time per request (only success): 1.226
Request per second: 0.82

# call with multiple cookies
$ python surcharge.py http://httpbin.org/cookies --cookies ck:1, cook:value

# call with HTTP Basic Auth
$ python surcharge.py https://secure.test.com --auth user:password

# bench during 10 seconds
$ python surcharge.py http://google.com --concurrency 10 --duration 10

# repeat the same bench twice
$ python surcharge.py http://google.com --concurrency 10 --duration 10 --repeat 2
```

Install
=======
```bash
$ pip -r requirements.txt #and enjoy
```

Usage
=====
```bash
usage: surcharge.py [-h] [-method {GET,POST,PUT,DELETE}]
[--concurrency CONCURRENCY] [--numbers NUMBERS]
[--cookies [COOKIES [COOKIES ...]]] [--content-type CT]
[--timeout TIMEOUT] [--auth AUTH] [--duration DURATION]
url

Surcharge tools

positional arguments:
url URL you want overload

optional arguments:
-h, --help show this help message and exit
-method {GET,POST,PUT,DELETE}
HTTP method.
--concurrency CONCURRENCY
Number of multiple requests to perform at a time.
Default is one request at a time.
--numbers NUMBERS Number of requests to perform for the benchmarking
session. Default is one request.
--cookies [COOKIES [COOKIES ...]]
Send your own cookies. cookie:value
--content-type CT Specify our content-type.
--timeout TIMEOUT You can tell requests to stop waiting for a response
after a given number of seconds.
--auth AUTH Making requests with HTTP Basic Auth. user:password
--duration DURATION Duration. Override the --numbers option.
--repeat REPEAT Repeat the benchmark.
--quiet The general outcome is hidden.
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

surcharge-0.3.tar.gz (4.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page