0.0.1-alpha.5 • Published 4 years ago

@negev/cli v0.0.1-alpha.5

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

@negev/cli

npm version Build Status

Benchmark your GraphQL servers with ease.

Installation

npm install -g @negev/cli

Demo

Why

Common loadtesting tools expect you to read documentation, write configuration files or hack together multline bash scripts. negev doesn't. Just run the negev command and answer some questions. (Don't worry, you still can write bash scripts - scroll down further for an example).

Additionally, most of them weren't written with GraphQL in mind, while this one exclusively serves the purpose of loadtesting GraphQL servers, for example:

  • Proper error detection: GraphQL queries that run into errors will commonly still have a 200 response, with the distinction that their body contains the errors field. Since most tools written for plain REST servers simply look at the HTTP statuscode of each response, they wouldn't even detect that something went wrong.
  • Schema validation: If you're querying something that isn't in your schema, negev won't even start loadtesting, saving you valuable time.

Usage

$ negev --help

Benchmark your GraphQL servers with ease.

USAGE
  $ negev

OPTIONS
  -H, --headers=headers                    request header. can be set multiple times. example: -H="Content-Type: application/json"
  -c, --concurrencyLimit=concurrencyLimit  the limit of concurrent requests
  -d, --duration=duration                  the total duration of the loadtest
  -e, --endpoint=endpoint                  the endpoint to test
  -h, --help                               show CLI help
  -n, --numberRequests=numberRequests      the number of requests to send
  -q, --query=query                        the query to use
  -r, --rateLimit=rateLimit                the limit of requests per second
  -v, --version                            show CLI version

EXAMPLES
  $ negev    # Will run the command in prompt-mode
  $ negev -e="http://localhost:4000" -q="{ books { author } }"   # Will immediately start a loadtest with the given configuration

Output

Summary:
 Total requests:      1000
 Loadtest duration:   823 ms
 Slowest:             57 ms
 Fastest:             21 ms
 Average:             40.02 ms
 Requests/sec:        1215.07

Histogram:
  21 ms: 1
  25 ms: 4
  29 ms: 23
  33 ms: 153
  37 ms: 242
  41 ms: 246
  45 ms: 202
  49 ms: 95
  53 ms: 26
  57 ms: 8
  61 ms: 0

Latency Distribution:
  10% in 28 ms
  25% in 36 ms
  50% in 31 ms
  75% in 43 ms
  90% in 48 ms
  95% in 50 ms
  99% in 54 ms

Error distribution:
 Successes   1000
 Errors      0