LinuxCommandLibrary

siege

Stress test websites with concurrent users

TLDR

Test a URL with default settings

$ siege [https://example.com]
copy

Test a list of URLs
$ siege [[-f|--file]] [path/to/url_list.txt]
copy

Test list of URLs in a random order (Simulates internet traffic)
$ siege [[-i|--internet]] [[-f|--file]] [path/to/url_list.txt]
copy

Benchmark a list of URLs (without waiting between requests)
$ siege [[-b|--benchmark]] [[-f|--file]] [path/to/url_list.txt]
copy

Set the amount of concurrent connections
$ siege [[-c|--concurrent]] [50] [[-f|--file]] [path/to/url_list.txt]
copy

Set how long for the siege to run for
$ siege [[-t|--time]] [30s] [[-f|--file]] [path/to/url_list.txt]
copy

SYNOPSIS

siege [options] URL...
siege -f FILE

PARAMETERS

-c
    Concurrent users. Sets the number of simultaneous users to simulate.

-r
    Repeats. Specifies the number of times each user will repeat the test (transactions per user).

-t
    Time duration. Runs the test for a specified duration (e.g., `10s` for 10 seconds, `5m` for 5 minutes).

-f
    URLs file. Reads a list of URLs from a specified file, one URL per line, to test.

-b
    Benchmark mode. Disables all delays between requests, running at maximum speed for pure performance testing.

-i
    Internet simulation. Introduces random delays between requests to simulate more realistic human browsing behavior.

-v
    Verbose output. Displays more detailed information and progress during the test run.

-g
    GET URL. Retrieves and displays HTTP headers and the content of a single URL without performing a benchmark.

-H 'Header: Value'
    Add header. Adds a custom HTTP header to all outgoing requests (e.g., for authentication).

-A 'User-Agent'
    Set User-Agent. Specifies the User-Agent string to be sent with requests.

-L
    Log errors. Logs failed transactions to a separate file for later analysis.

--no-follow
    No redirects. Prevents Siege from automatically following HTTP redirects (3xx responses).

DESCRIPTION

Siege is an open-source command-line utility designed for HTTP load testing and benchmarking. It is used to measure the performance of a web server under stress, assessing its capacity to handle concurrent users, its response time, and throughput. Siege simulates multiple users accessing a website simultaneously, sending requests to specified URLs and reporting comprehensive statistics. These statistics include the number of transactions, bytes transferred, average response time, and server errors. It's an invaluable tool for developers and system administrators to identify performance bottlenecks, assess server stability, and optimize web application performance before deployment.

CAVEATS

Siege can generate significant load on a server and should be used with extreme caution. Testing production servers not under your control without explicit permission may be perceived as a denial-of-service attack and could lead to legal consequences. Ensure the client machine running Siege has sufficient resources (CPU, network, memory) to avoid becoming a bottleneck itself, which would invalidate test results.

CONFIGURATION FILE

Siege can be extensively configured using a dedicated file, typically located at ~/.siege/siege.conf. This configuration file allows users to set default values for various command-line options, such as the number of concurrent users, test duration, and logging preferences. It also supports defining custom user agents, authentication credentials, and pre-loading a list of URLs, streamlining repetitive testing scenarios.

OUTPUT METRICS

Upon completion of a test, Siege provides a concise summary of key performance metrics. These include the total number of transactions, successful and failed requests, the total data transferred, average response time, as well as the longest and shortest response times. It also reports the transaction rate, throughput (data per second), and average concurrency, offering a comprehensive overview of the server's performance under load.

HISTORY

Siege was originally developed by Jeff Starr in the early 2000s, designed as a simple yet powerful command-line tool for web developers and system administrators. Its primary goal was to offer an easy-to-use alternative to more complex benchmarking suites, enabling quick and effective testing of web application and server performance and stability by simulating realistic user traffic patterns.

SEE ALSO

ab(1), curl(1), wget(1)

Copied to clipboard