Vous voulez benchmarquer un serveur de manière rapide et simple? Bon ok, c’est pas du vrai test en charge comme ce que l’on pourrait faire avec JMetter, mais ça permet d’avoir une idée des perfs et de pouvoir comparer des évolutions.

sudo apt install apache2-utils

Puis :

ab -n 30000 -c 30 http://localhost:8080/

  • -n : le nombre de requêtes
  • -c : le nombre de requêtes en parallèle

Et hop un résultat :

This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 3000 requests
Completed 6000 requests
Completed 9000 requests
Completed 12000 requests
Completed 15000 requests
Completed 18000 requests
Completed 21000 requests
Completed 24000 requests
Completed 27000 requests
Completed 30000 requests
Finished 30000 requests

Server Software:
Server Hostname: localhost
Server Port: 8080

Document Path: /#/immo
Document Length: 9 bytes

Concurrency Level: 30
Time taken for tests: 18.746 seconds
Complete requests: 30000
Failed requests: 0
Non-2xx responses: 30000
Total transferred: 1620000 bytes
HTML transferred: 270000 bytes
Requests per second: 1600.34 [#/sec] (mean)
Time per request: 18.746 [ms] (mean)
Time per request: 0.625 [ms] (mean, across all concurrent requests)
Transfer rate: 84.39 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.9 0 23
Processing: 1 18 13.3 14 173
Waiting: 0 18 13.3 14 173
Total: 2 19 13.3 15 174

Percentage of the requests served within a certain time (ms)
50% 15
66% 20
75% 23
80% 26
90% 35
95% 45
98% 55
99% 62
100% 174 (longest request)

Leave a Comment