JavaScript load testing

JavaScript load testing for Node.js teams

Use LoadStrike for JavaScript load and performance testing on Node.js 20+. Write async HTTP steps and track downstream completion with reports.

LoadStrike documentation map for JavaScript scenarios, runtime configuration and reports
Write JavaScript performance scenarios, verify SDK requirements and measure request or downstream completion evidence.

How do you write a JavaScript load test with LoadStrike?

LoadStrike lets Node.js teams write JavaScript load tests using async callbacks, named steps and the @loadstrike/loadstrike-sdk package. Engineers can keep request logic and workload configuration in their existing JavaScript tooling. Begin with one HTTP operation, then add an observable completion event when the response starts work in a queue or another service.

Start with a small test

Install and start an API load test in JavaScript

This JavaScript request-step snippet uses CommonJS require and an async IIFE. Use a .cjs file when your project declares type: module. The linked js project uses ESM .mjs instead; replace the example target and placeholder runner key in either setup.

The request-step example offers 10 scenario invocations per second for 20 seconds. Replace the example endpoint with an authorized staging service and the placeholder with your valid runner key. Offered scenario invocations are not measured HTTP throughput or a benchmark result.

SDK installation

npm install @loadstrike/loadstrike-sdk

const { LoadStrikeRunner } = require("@loadstrike/loadstrike-sdk");

Request-step example

const {
  LoadStrikeResponse,
  LoadStrikeRunner,
  LoadStrikeScenario,
  LoadStrikeSimulation,
  LoadStrikeStep
} = require("@loadstrike/loadstrike-sdk");

(async () => {
  const scenario = LoadStrikeScenario
    .create("read-order", async (context) => {
      return LoadStrikeStep.run("GET /orders/{id}", context, async () => {
        const orderId = `ord-${context.invocationNumber}`;
        const response = await fetch(`https://api.example.com/orders/${orderId}`);

        return response.ok
          ? LoadStrikeResponse.ok(String(response.status))
          : LoadStrikeResponse.fail(String(response.status), "Order lookup failed");
      });
    })
    .withLoadSimulations(LoadStrikeSimulation.inject(10, 1, 20));

  await LoadStrikeRunner
    .registerScenarios(scenario)
    .withRunnerKey("rkl_your_local_runner_key")
    .run();
})();
Proof

Evidence to review

Use these pages and artifacts to validate the public claims on this page.

JavaScript sample project

Inspect the project configuration, imports and source examples. Dummy runner keys must be replaced.

Who this is for

Node.js service owners and JavaScript test engineers who want self-hosted performance scenarios without introducing a different authoring language. The first example uses fetch and an async entry point, making it clear which request is awaited and which status becomes a run result.

Package, runtime and client setup

Install with npm install @loadstrike/loadstrike-sdk on Node.js 20+. The SDK supports CommonJS require and ESM imports. The introductory JavaScript snippet uses require inside an async IIFE; save it as a .cjs file if your project declares type: module. The public js reference project instead uses .mjs ESM examples. Match the module format to your own project.

From request timing to completion

For a background job or realtime channel, make the completion signal explicit and preserve a shared tracking value through source and destination. Configure the endpoint modes and correlation timeout before increasing traffic. For gRPC, your generated client must run inside a matching Produce or Consume delegate; native gRPC execution is unavailable.

Execution and plan requirements

  • Use npm package @loadstrike/loadstrike-sdk on Node.js 20+ and provide a valid runner key. LoadStrike runs on your own infrastructure.
  • Check the plan for the selected endpoints, reports and execution mode. gRPC and WebSocket endpoints require Pro or Enterprise; extra clients do not grant plan access.
  • Review HTML, CSV, TXT or Markdown reports and run failures. These examples demonstrate SDK setup; they are not comparative benchmarks or throughput guarantees.

Define the workload and inspect the evidence

Start with a small request-step test against a staging system you control. To measure later completion, define the matching endpoints and tracking value before interpreting transaction latency.

Introduce the workload into your test project

  • Keep existing functional tests and load scripts that already answer a release question. Add a small LoadStrike staging scenario and compare the same acceptance criteria, data and report evidence before changing the wider test suite.
  • Await work that belongs to the scenario and manage long-lived connections deliberately. JavaScript browser journeys use an additional Playwright or Selenium client, while native WebSocket execution uses Node.js; running the SDK does not make every HTTP step a browser session.
Common questions

Common questions

Should the JavaScript example use .js or .cjs?

The displayed snippet uses CommonJS require. Use .cjs in an ESM project, or adapt the imports to your existing module format. The SDK provides both CommonJS and ESM exports.

Can I use async JavaScript clients in a load test?

Yes. Await the operation inside the scenario or named step, then return the appropriate LoadStrike success or failure reply. Configure client cleanup and timeouts and inspect report failures before scaling load.

Related

Related documentation

Start with the implementation details that match this page.

Installation

Install the LoadStrike package for your language and add it to the test project you already use. This page is the starting point before you write a scenario.

Quick Start

Build one basic request-step scenario around GET /orders/{id}, run it, and confirm the report before moving into correlation-specific features.

Load Simulation

Load simulations describe how traffic should arrive over time. Use them to model the shape of the workload instead of only its peak.

WebSocket Protocol Guide

Use this guide when long-lived WebSocket sessions, message matching, or realtime channels need to be part of a performance or transaction test.

Selenium UI Load Guide

Use this guide when Selenium browser journeys should run inside the same LoadStrike transaction and reporting model.

Related

Related comparisons

Use these comparison pages if you still need a tool-level decision.

LoadStrike vs k6

Compare LoadStrike and k6 for APIs, Kafka, browser tests and async completion, including correlation requirements, extensions and hosting tradeoffs.

LoadStrike vs Apache JMeter

Compare LoadStrike and Apache JMeter for async completion, JMS, browser execution, reports and self-hosted testing, including setup and licensing requirements.

Next steps

Start one JavaScript performance scenario

Start one JavaScript performance scenario

Install the SDK, provide a valid runner key and review one small staging run before increasing load or adding downstream correlation.