k6

A modern load testing tool, using Go and JavaScript

"like unit testing, for performance"

k6 is a modern load testing tool, building on Load Impact's years of experience. It provides a clean, approachable JavaScript scripting API, distributed and cloud execution, and orchestration via a REST API.

Get Started    Guides

sleep( t )

Suspend VU execution for the specified duration.

Parameter
Type
Description

t

number

Duration, in seconds.

import { sleep } from "k6";
import http from "k6/http";

export default function() {
  http.get("https://loadimpact.com");
  sleep(Math.random() * 30);
  http.get("https://loadimpact.com/features");
};

Fetching two different pages with a 0-30 second random sleep in between