StepZen is now part of IBM. For the most recent product information and updates visit our
IBM product page.

Measure API Performance

StepZen is fast and reliable, running over 5,000 requests per second in under 100ms of latency

One of the most critical metrics for any API is its performance. StepZen is optimized to deliver you a fast and reliable GraphQL API.

StepZen Load Test

Compared to other services like Google and HTTPbin, StepZen is fast from all over the globe. Below you can see the results of a load test comparing StepZen to both Google and HTTPbin, executed from the datacenter the StepZen service is running from:

target_google_counter..................: 1531   148.947278/s
target_google_timer....................: avg=132.643025 min=76.969405 med=99.088328 max=1225.462018 p(90)=226.365157 p(95)=284.018227
target_httpbin_counter.................: 1604   156.049271/s
target_httpbin_timer...................: avg=44.518655  min=28.426016 med=31.274171 max=836.16289   p(90)=34.938617  p(95)=96.231421
target_stepzenversiongraphql_counter...: 31581  3072.438929/s
target_stepzenversiongraphql_timer.....: avg=11.480876  min=2.968022  med=6.798161  max=1137.767697 p(90)=16.171646  p(95)=27.368116

When pinged from outside the datacentre that StepZen is running from, the latency can be below 100ms (depending on your distance to the data center). Scroll down to the section Testing API performance to run a test of your own.

Test Your API's Performance

We have created a tool called StepZen GraphQL Benchmark to help you test the performance of your StepZen GraphQL API yourself. You can find the code in this GitHub repository.

Installation

Follow the steps below to install StepZen GraphQL Benchmark:

  1. Clone the files in this repository to your local machine.

Note: You need to have k6 installed on your local machine to run this GraphQL benchmark.

  1. Run the following command to install to install k6 on MacOS:
brew install k6

For installation instructions on Linux, Windows, or Docker, see this installation guide.

Run the Benchmark

Run the following command to benchmark using the configuration options described in driver.js:

k6 run --vus 10 --duration 30s driver.js

This runs the load test with 10 virtual users for 30 seconds. You can alter the values for --vus and --duration in the command to run the test with a different amount of virtual users or a different duration.

The endpoints you can test against are listed in the targets block in endpoints/index.js. The default endpoint returns the current version of StepZen:

export const targets = [
  { target: google, weight: 0 },
  { target: yahoo, weight: 0 },
  { target: httpbin, weight: 0 },
  { target: stepzenVersion, weight: 1 },
  { target: stepzenLight, weight: 0 },
  { target: stepzenHeavy, weight: 0 },
];

By changing the value for weight you can also run the test against other endpoints and compare the performance of StepZen to other services like Google or Yahoo. To test StepZen against Google, set the weight for Google to 1:

export const targets = [
  { target: google, weight: 1 },
  { target: yahoo, weight: 0 },
  { target: httpbin, weight: 0 },
  { target: stepzenVersion, weight: 1 },
  { target: stepzenLight, weight: 0 },
  { target: stepzenHeavy, weight: 0 },
];

Test your own Endpoint

To test your own StepZen GraphQL API, alter the variables stepzenLight and stepzenHeavy in endpoints/index.js. If you want to test a light query, for example a query without nested fields, alter stepzenLight:

const stepzenLight = {
  method: 'POST',
  endpoint: 'REPLACE_WITH_YOUR_OWN_STEPZEN_ENDPOINT',
  counterName: 'stepzenLight',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    query: `
      query MyQuery {
        // INSERT_YOUR_OWN_QUERY
      }
    `,
  }),
};

Make sure to set the weight for stepzenLight to 1 after filling in your StepZen GraphQL API endpoint and inserting a query for this endpoint. You could repeat the same steps for stepzenHeavy if you want to test more complex queries that send requests to multiple data sources or contain heavily nested fields.