Test how well a web server handles concurrent connections and big load.

ab -n 1000 -c 100 http://127.0.0.1:8000/
This command will execute 1000 requests to the http URL http://127.0.0.1:8000 handlink 100 concurent connections at a time. Then it will display statistics about the time that have been taken.
Sample Output
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:
Server Hostname:        127.0.0.1
Server Port:            8000

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      100
Time taken for tests:   20.948 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      113000 bytes
HTML transferred:       12000 bytes
Requests per second:    47.74 [#/sec] (mean)
Time per request:       2094.826 [ms] (mean)
Time per request:       20.948 [ms] (mean, across all concurrent requests)
Transfer rate:          5.27 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   7.8      0      37
Processing:  2001 2063  94.4   2014    2353
Waiting:        1   46  64.8      9     241
Total:       2001 2066 100.4   2014    2369

Percentage of the requests served within a certain time (ms)
  50%   2014
  66%   2032
  75%   2098
  80%   2122
  90%   2228
  95%   2359
  98%   2365
  99%   2365
 100%   2369 (longest request)

2
2014-02-18 09:32:01

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: