Performance
There are a pletora of approaches to measure a performance of a software. I've been noticing that ab
and weighttp
seem to be recommended often.
ab
Run the command ab -n 1000000 -c 100 -k http://127.0.0.1:8080/
to measure performance.
Check Requests per second
.
➜ ~ ab -n 1000000 -c 100 -k http://127.0.0.1:8080/
This is ApacheBench, Version 2.3 <$Revision: 1554214 $>
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 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 requests
Completed 1000000 requests
Finished 1000000 requests
Server Software: tmprl
Server Hostname: 127.0.0.1
Server Port: 8080
Document Path: /
Document Length: 149 bytes
Concurrency Level: 100
Time taken for tests: 17.084 seconds
Complete requests: 1000000
Failed requests: 0
Keep-Alive requests: 1000000
Total transferred: 305000000 bytes
HTML transferred: 149000000 bytes
Requests per second: 58535.85 [#/sec] (mean)
Time per request: 1.708 [ms] (mean)
Time per request: 0.017 [ms] (mean, across all concurrent requests)
Transfer rate: 17435.00 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 4
Processing: 0 2 1.9 1 65
Waiting: 0 2 1.9 1 65
Total: 0 2 1.9 1 65
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 2
80% 2
90% 3
95% 4
98% 5
99% 6
100% 65 (longest request)
weighttp
Run the command weighttp -n 100000 -c 100 -t 4 -k "http://localhost:8080/"
.
➜ ~ weighttp -n 100000 -c 100 -t 4 -k "http://localhost:8080/"
weighttp - a lightweight and simple webserver benchmarking tool
starting benchmark...
spawning thread #1: 25 concurrent requests, 25000 total requests
spawning thread #2: 25 concurrent requests, 25000 total requests
spawning thread #3: 25 concurrent requests, 25000 total requests
spawning thread #4: 25 concurrent requests, 25000 total requests
progress: 10% done
progress: 20% done
progress: 30% done
progress: 40% done
progress: 50% done
progress: 60% done
progress: 70% done
progress: 80% done
progress: 90% done
progress: 100% done
finished in 1 sec, 600 millisec and 244 microsec, 62490 req/s, 17148 kbyte/s
requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored
status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx
traffic: 28100000 bytes total, 13200000 bytes http, 14900000 bytes data