LinuxCommandLibrary

loadtest

Simulate user load on a web server

TLDR

Run with concurrent users and a specified amount of requests per second

$ loadtest --concurrency [10] --rps [200] [https://example.com]
copy

Run with a custom HTTP header
$ loadtest --headers "[accept:text/plain;text-html]" [https://example.com]
copy

Run with a specific HTTP method
$ loadtest --method [GET] [https://example.com]
copy

SYNOPSIS

loadtest [options]

PARAMETERS

-n
    Number of requests to perform.

-c
    Number of concurrent clients.

-t
    Maximum test duration in seconds.

-k
    Keep alive, use a single TCP connection per client.

-p
    HTTP proxy to use.

-m
    HTTP method to use (GET, POST, PUT, DELETE, etc.). Default is GET.

-d
    Data to send in the request body. Only applicable for POST, PUT etc.

-H
    Custom HTTP header to send (e.g., 'Content-Type: application/json').

--timeout
    Socket timeout in seconds. Default 10 seconds.

-q
    Quiet, suppress output.

-u
    HTTP basic authentication credentials.

-v
    Verbose output, show individual request timings.

DESCRIPTION

loadtest is a command-line tool for performing basic HTTP load testing. It allows you to simulate a number of concurrent clients making requests to a specified URL. It's useful for quickly gauging the performance of a web server or API endpoint under light to moderate load. Unlike more sophisticated load testing tools, loadtest is designed for simplicity and ease of use, trading advanced features for a straightforward command-line interface. It provides basic metrics such as requests per second, latency, and error counts. It doesn't support complex scenarios like request scripting, parameterization, or detailed reporting. However, its simplicity makes it suitable for initial performance checks and quick assessments of server responsiveness.
loadtest is open-source and often used by developers to identify bottlenecks early in the development process. Its output is generally presented in a human-readable format, making it easy to interpret the results and identify potential issues.

CAVEATS

loadtest provides a relatively basic level of load testing. It's not suitable for simulating complex user behavior or high-load scenarios. The statistics it provides are limited and may not be sufficient for in-depth performance analysis.

INTERPRETING RESULTS

Pay attention to the requests per second (RPS), average latency, and error rates. High latency or a significant increase in error rates under load indicates potential performance bottlenecks. Observe the impact of different concurrency levels on the server's responsiveness.

HISTORY

The specific history of the 'loadtest' command can vary depending on the specific implementation (many exist). Generally, such tools emerged as a need to quickly assess the basic performance of web servers and applications as web development became more prevalent. The goal was to provide a simple, command-line interface for simulating HTTP traffic and observing response times and error rates. Some implementations are open-source and maintained by individual developers or communities, while others may be part of larger testing frameworks.

SEE ALSO

ab(1), wrk(1)

Copied to clipboard