ab
Quick Reference
Command Name:
ab
Category:
web server
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Web server performance testing
Benchmark HTTP server performance by measuring requests per second
- 2
Load testing
Simulate multiple concurrent users to test server capacity under load
- 3
Performance optimization
Identify bottlenecks and optimize web server configurations
- 4
Capacity planning
Determine server capacity requirements for production deployments
Syntax
ab [options] [http[s]://]hostname[:port]/path
Options
| Option | Description |
|---|---|
| -n requests | Number of requests to perform |
| -c concurrency | Number of multiple requests to make at a time |
| -t timelimit | Seconds to max. wait for responses |
| -b windowsize | Size of TCP send/receive buffer, in bytes |
| -p postfile | File containing data to POST |
| -u putfile | File containing data to PUT |
| -T content-type | Content-type header for POST/PUT data |
| -v verbosity | How much troubleshooting info to print |
| -w | Print out results in HTML tables |
| -i | Do HEAD requests instead of GET |
| -x attributes | String to insert as table attributes |
| -y attributes | String to insert as tr attributes |
| -z attributes | String to insert as td or th attributes |
| -C attribute | Add cookie, e.g. 'Apache=1234' (repeatable) |
| -H attribute | Add arbitrary header (repeatable) |
| -A attribute | Add Basic WWW Authentication, attribute is username:password |
| -P attribute | Add Basic Proxy Authentication, attribute is username:password |
| -X proxy:port | Proxyserver and port number to use |
| -k | Use HTTP KeepAlive feature |
| -g gnuplot-file | Output collected data to gnuplot format file |
| -e csv-file | Output CSV file with percentages served |
| -S | Do not display error messages and warnings |
| -q | Do not display progress while running |
| -h | Display usage information |
Examples
How to Use These Examples
The examples below show common ways to use the ab command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
ab -n 100 -c 10 http://example.com/
ab -n 1000 -c 50 https://example.com/
ab -n 500 -c 25 http://example.com/about.html
ab -n 100 -c 10 -g results.tsv http://example.com/