# siege — HTTP Load Testing from the Command Line

> Practical guide to Siege — simulate concurrent users, benchmark web servers, feed URL lists, add custom headers, and get detailed performance reports.

Source: https://www.jpkc.com/db/en/cheatsheets/networking/siege/

<!-- PROSE:intro -->
Siege simulates any number of concurrent users hammering your web server – the fastest way to expose bottlenecks before your next deployment. Feed it a single URL or an entire URL list and it reports throughput, response times, and failure rates in a concise summary. Fine-tune the load with flags for delay, concurrency, and duration – or reach for a `.siegerc` file when you need repeatable test configurations.
<!-- PROSE:intro:end -->

## Basic Usage

`siege <url>` — Start a load test with default settings (25 users, no time limit).

```bash
siege http://localhost:8080/
```

`siege -c <users> -t <time> <url>` — Test with specific concurrent users and duration.

```bash
siege -c 50 -t 30S http://localhost:8080/
```

`siege -c <users> -r <reps> <url>` — Run with fixed number of repetitions per user.

```bash
siege -c 25 -r 100 http://localhost:8080/
```

`siege -b <url>` — Benchmark mode: no delay between requests.

```bash
siege -b -c 50 -t 30S http://localhost:8080/
```

## URL Files & Multiple URLs

`siege -f <file>` — Read URLs from a file (one per line).

```bash
siege -f urls.txt -c 25 -t 60S
```

`siege '<url1>' '<url2>' '<url3>'` — Test multiple URLs from command line.

```bash
siege 'http://localhost/' 'http://localhost/api' 'http://localhost/about'
```

`siege -i -f <file>` — Internet mode: randomly select URLs from file.

```bash
siege -i -f urls.txt -c 50 -t 120S
```

## HTTP Methods & Data

`siege -c <users> '<url> POST <data>'` — Send POST requests with data.

```bash
siege -c 10 'http://localhost/api POST {"name":"test"}'
```

`siege -H 'Content-Type: application/json' '<url> POST <data>'` — POST with JSON content type header.

```bash
siege -H 'Content-Type: application/json' -c 10 'http://localhost/api POST {"key":"value"}'
```

`siege -H '<header>' <url>` — Add a custom HTTP header.

```bash
siege -H 'Authorization: Bearer token123' -c 25 http://localhost/api
```

`siege -A '<user-agent>' <url>` — Set a custom User-Agent string.

```bash
siege -A 'Mozilla/5.0 LoadTest' -c 25 http://localhost/
```

## Timing & Delays

`siege -d <seconds> <url>` — Set random delay between 0 and N seconds per request.

```bash
siege -d 5 -c 50 http://localhost:8080/
```

`siege -b -t <time> <url>` — Benchmark: zero delay, maximum throughput test.

```bash
siege -b -t 60S -c 100 http://localhost:8080/
```

`siege -t 1M <url>` — Run for 1 minute (S=seconds, M=minutes, H=hours).

```bash
siege -t 5M -c 50 http://localhost:8080/
```

## Logging & Output

`siege -v <url>` — Verbose: show each transaction.

```bash
siege -v -c 5 -r 10 http://localhost:8080/
```

`siege --log=<file> <url>` — Log results to a specific file.

```bash
siege --log=siege.log -c 50 -t 60S http://localhost:8080/
```

`siege -m '<message>' <url>` — Add a label/message to the log entry.

```bash
siege -m 'v2.0 release test' -c 50 -t 60S http://localhost:8080/
```

`siege --json-output <url>` — Output results in JSON format.

```bash
siege --json-output -b -c 50 -t 30S http://localhost:8080/
```

## Configuration

`siege.config` — Generate a default .siegerc configuration file.

```bash
siege.config
```

`siege -R <file> <url>` — Use a specific configuration file.

```bash
siege -R /path/to/.siegerc -c 50 http://localhost:8080/
```

`siege -C` — Show the current configuration.

```bash
siege -C
```

<!-- PROSE:outro -->
## Conclusion

Siege is the most direct path to knowing whether your server handles real load. Start with a quick benchmark run, refine with a URL list, and label every test series with `-m` before pushing to production – find the bottlenecks before your users do.

## Further Reading

- [Siege – User Manual](https://www.joedog.org/siege-manual/) – complete reference for all options and configuration parameters
- [Siege – GitHub](https://github.com/JoeDog/siege) – source code, changelog, and issue tracker
<!-- PROSE:outro:end -->

## Related Commands

- [ab](https://www.jpkc.com/db/en/cheatsheets/networking/ab/) – Apache's built-in tool for quick HTTP benchmarks
- [wrk](https://www.jpkc.com/db/en/cheatsheets/networking/wrk/) – modern HTTP benchmarking with Lua scripting
- [h2load](https://www.jpkc.com/db/en/cheatsheets/networking/h2load/) – load testing for HTTP/2 and HTTP/3 servers

