Linux command
siege 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Test a URL
siege [https://example.com/]
Benchmark with specific concurrency
siege -c [50] -t [1M] [https://example.com/]
Run benchmark mode
siege -b -c [100] -t [30S] [https://example.com/]
Test multiple URLs
siege -f [urls.txt]
Simulate internet traffic
siege -i -f [urls.txt] -c [25] -t [5M]
Run with custom delay
siege -d [2] -c [10] [https://example.com/]
Display headers
siege -g [https://example.com/]
Show current configuration
siege -C
说明
siege is a multi-threaded HTTP/HTTPS load testing and benchmarking utility. It simulates multiple concurrent users accessing a web server to measure performance under stress. Metrics reported include response time, transaction rate, throughput, concurrency, and availability. The tool operates in three modes: regression (sequential URL testing), internet simulation (randomized access patterns with -i), and brute force benchmarking (maximum throughput with -b). By default, each simulated user pauses randomly between requests to simulate realistic traffic. The -d option controls this delay range, while -b eliminates it entirely for pure throughput testing. Configuration is stored in ~/.siege/siege.conf. URLs can be specified on the command line or in a file with -f, supporting POST data and custom headers.
参数
- -c, --concurrent _num_
- Number of concurrent simulated users (default: 15)
- -r, --reps _num_|once
- Number of repetitions per user; "once" runs each URL once
- -t, --time _NUMm_
- Run duration with modifier: S (seconds), M (minutes), H (hours)
- -d, --delay _num_
- Random delay (0 to num seconds) between requests per user
- -b, --benchmark
- Benchmark mode; removes delays for maximum throughput
- -f, --file _file_
- Read URLs from a text file
- -i, --internet
- Simulate internet traffic by randomizing URL order
- -g, --get _URL_
- Display HTTP headers for a single request
- -p, --print _URL_
- Display headers and response body
- -A, --agent _string_
- Override the User-Agent header
- -H, --header _"header: value"_
- Add custom request header
- -T, --content-type _type_
- Override Content-Type header
- -v, --verbose
- Show detailed output with color-coded responses
- -q, --quiet
- Suppress output; useful for scripts
- -L, --log _file_
- Write results to specified log file
- -m, --mark _"string"_
- Log a marker message before stats; useful for identifying test runs
- -R, --rc _file_
- Use alternative configuration file
- --no-follow
- Do not follow 3xx redirects
- -C, --config
- Display current configuration settings
FAQ
What is the siege command used for?
siege is a multi-threaded HTTP/HTTPS load testing and benchmarking utility. It simulates multiple concurrent users accessing a web server to measure performance under stress. Metrics reported include response time, transaction rate, throughput, concurrency, and availability. The tool operates in three modes: regression (sequential URL testing), internet simulation (randomized access patterns with -i), and brute force benchmarking (maximum throughput with -b). By default, each simulated user pauses randomly between requests to simulate realistic traffic. The -d option controls this delay range, while -b eliminates it entirely for pure throughput testing. Configuration is stored in ~/.siege/siege.conf. URLs can be specified on the command line or in a file with -f, supporting POST data and custom headers.
How do I run a basic siege example?
Run `siege [https://example.com/]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -c, --concurrent _num_ do in siege?
Number of concurrent simulated users (default: 15)