0.0.1-alpha.2 • Published 4 years ago

@negev/core v0.0.1-alpha.2

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

@negev/core

npm version Build Status codecov

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.

ParameterDefaultDescription
endpointRequiredThe endpoint to test
queryRequiredThe query / mutation to send
headersNoneThe headers attached to each request
rateLimitNoneThe limit for how many requests are sent per second
concurrencyLimit50The limit for how many concurrent requests can be sent
duration15The duration (in seconds) of the loadtest.
numberRequests500The 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,
});