LinuxCommandLibrary

http_load

Load test web servers with simulated traffic

TLDR

Emulate 20 requests based on a given URL list file per second for 60 seconds

$ http_load -rate [20] -seconds [60] [path/to/urls.txt]
copy

Emulate 5 concurrent requests based on a given URL list file for 60 seconds
$ http_load -parallel [5] -seconds [60] [path/to/urls.txt]
copy

Emulate 1000 requests at 20 requests per second, based on a given URL list file
$ http_load -rate [20] -fetches [1000] [path/to/urls.txt]
copy

Emulate 1000 requests at 5 concurrent requests at a time, based on a given URL list file
$ http_load -parallel [5] -fetches [1000] [path/to/urls.txt]
copy

SYNOPSIS

http_load [options] url_file

PARAMETERS

-fetches N
    
Specifies the total number of fetches (requests) to perform. The test will run until N requests have been completed.

-rate R
    
Defines the target request rate in fetches per second. `http_load` will attempt to maintain this rate.

-parallel P
    
Sets the number of concurrent connections (clients) to use during the test.

-seconds S
    
Determines the total duration of the test in seconds. The test will run for S seconds, attempting to make as many fetches as possible within this time.

-timeout T
    
Sets the connection timeout in seconds. If a connection doesn't receive a response within T seconds, it's considered an error.

-proxy host:port
    
Specifies an HTTP proxy to use for all requests. Requests will be routed through this proxy.

-burst B
    
When used with -rate, this option sends B requests in a rapid burst whenever the rate allows, rather than spreading them evenly.

-verbose
    
Prints more detailed information during the test execution, including individual response times.

DESCRIPTION

`http_load` is a lightweight yet powerful command-line utility for benchmarking web servers. It is designed to test a web server's capacity by fetching many HTTP URLs in parallel. Unlike full-fledged browsers, `http_load` focuses purely on the HTTP protocol, making it efficient for generating significant load from a single client machine. It reads a list of URLs from a file and can simulate various load patterns by controlling parameters like the number of fetches, the request rate, or the duration of the test. The tool provides valuable statistics on completion, including the total number of fetches, fetches per second, bytes transferred, bytes per second, and detailed response time metrics (mean, minimum, maximum, standard deviation). This makes `http_load` an excellent choice for quick performance assessments, stress testing, and identifying potential bottlenecks in web server configurations. It's often favored for its simplicity and minimal resource footprint compared to more complex load testing frameworks.

CAVEATS

Client-side limitations: The performance of the client machine running `http_load` can become a bottleneck itself, especially for very high loads. Ensure the client has sufficient CPU, memory, and network capacity.

Simple HTTP requests: `http_load` performs simple GET or HEAD requests. It does not support POST requests, form submissions, cookie handling, session management, JavaScript execution, or full page rendering, making it unsuitable for testing complex application logic or user journeys.

Network dependency: Results can be significantly impacted by network latency and bandwidth between the `http_load` client and the target server.

No SSL/TLS support: Older versions of `http_load` may not support HTTPS (SSL/TLS) without specific compilation flags or external libraries. Modern versions often do, but it's worth verifying.

URL FILE FORMAT

The url_file is a plain text file where each line contains a single URL that `http_load` should fetch. Blank lines and lines starting with '#' (comments) are ignored. This allows for testing multiple different endpoints or pages on your web server.

CONTROLLING TEST DURATION AND LOAD

You typically choose one or two primary options to control the test:

  • To run for a specific duration with a fixed number of parallel connections, use `-seconds` and `-parallel`.
  • To run for a specific duration with a target request rate, use `-seconds` and `-rate`.
  • To perform a fixed number of total fetches, use `-fetches`.
  • Using `-fetches` with `-rate` will attempt to perform N fetches at rate R.

OUTPUT METRICS EXPLANATION

Upon completion, `http_load` reports several key metrics:

  • Fetches: Total number of successful requests.
  • Fetches/sec: Average number of requests completed per second.
  • Bytes: Total data transferred in bytes.
  • Bytes/sec: Average data transfer rate in bytes per second.
  • Response Time: Provides mean, minimum, maximum, and standard deviation for the time taken to receive a full response for each request.
  • Errors: Counts of different types of errors, such as connection refused, timeouts, or bad responses from the server.

HISTORY

`http_load` was developed by J. C. "Chris" Hornig as part of his work at the University of Pennsylvania. It emerged as a lightweight, efficient tool for basic web server performance testing in Unix-like environments. While its exact initial release date is not widely publicized, it has been available and used in the open-source community for many years, predating many more complex load testing frameworks. Its enduring popularity stems from its ease of use and effectiveness for quick, focused performance measurements.

SEE ALSO

ab(1), siege(1), wrk(1), curl(1)

Copied to clipboard