0.0.1-alpha.2 • Published 4 years ago
@negev/core v0.0.1-alpha.2
@negev/core
Benchmark your GraphQL servers with ease.
Installation
npm install @negev/core
Usage
Config
Depending on your configuration, you can execute a loadtest that runs for a certain amount of time (by setting duration
) or one that sends a specified amount of requests (by setting numberRequests
). Note that if both fields are present, numberRequests
will be ignored.
Parameter | Default | Description |
---|---|---|
endpoint | Required | The endpoint to test |
query | Required | The query / mutation to send |
headers | None | The headers attached to each request |
rateLimit | None | The limit for how many requests are sent per second |
concurrencyLimit | 50 | The limit for how many concurrent requests can be sent |
duration | 15 | The duration (in seconds) of the loadtest. |
numberRequests | 500 | The count of how many total requests are sent. |
Example - numberRequests
import { executeLoadtest } from '@negev/core';
const loadtestResult = await executeLoadtest({
endpoint: 'https://example.com/query',
query: '{ books { author } }',
headers: {
'Content-type': 'application/json',
},
numberOfRequests: 1000,
});
Example - duration
import { executeLoadtest } from '@negev/core';
const loadtestResult = await executeLoadtest({
endpoint: 'https://example.com/query',
query: '{ books { author } }',
headers: {
'Content-type': 'application/json',
},
duration: 15,
});
0.0.1-alpha.2
4 years ago
0.0.1-alpha.1
4 years ago