httperf (http stress test tool)

最後更新: 2022-07-25

 

 

Homepage

https://github.com/httperf/httperf

 


安裝

 

# Debian

apt-get install httperf

# Centos

EPEL 也沒有此 package

 


Usage

 

Connection base

httperf --server datahunter.org --port 80 --uri /index.php --rate 100 --timeout 5 --num-conn 3000

opts:

  • --rate N              # fixed rate at which connections or sessions are created (Default: --uri=/)
  • --timeout X         # wait for a server reaction (completed or failed)
  • --num-conn N      # A test stops as soon as the N connections have either completed or failed

Enable ssl

--ssl

Session base

httperf --hog --server=www --wsess=10,5,2 --rate 1 --timeout 5

options:

  • --hog                         # httperf to use up as many TCP ports as necessary.(Default: 1024 to 5000)
  • --wsess=10,5,2          # 10 session,  5 calls that are spaced out by 2 seconds
  • --num-call N               # requests should be sent per connection (default: 1) (server must support persistent connections)
  • --burst-length=N        # Each burst consists of N  calls  to  the  server

 


Result

 

Maximum connect burst length: 2

Total: connections 3000 requests 1506 replies 420 test-duration 37.988 s

Connection rate: 79.0 conn/s (12.7 ms/conn, <=676 concurrent connections)
Connection time [ms]: min 14.6 avg 1035.1 max 7997.3 median 826.5 stddev 1052.9
Connection time [ms]: connect 748.2
Connection length [replies/conn]: 1.000

Request rate: 39.6 req/s (25.2 ms/req)
Request size [B]: 67.0

Reply rate [replies/s]: min 0.0 avg 12.0 max 71.0 stddev 26.2 (7 samples)
Reply time [ms]: response 1443.2 transfer 74.4
Reply size [B]: header 485.0 content 9505.0 footer 1.0 (total 9991.0)
Reply status: 1xx=0 2xx=398 3xx=0 4xx=0 5xx=22

CPU time [s]: user 0.68 system 32.75 (user 1.8% system 86.2% total 88.0%)
Net I/O: 110.5 KB/s (0.9*10^6 bps)

Errors: total 2580 client-timo 2580 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0

 


Troubleshoot

 

一行 command 就

httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE

checking

httperf -v  | grep maximum

httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
httperf: maximum number of open descriptors = 1024

解決

recompile httperf

 

Creative Commons license icon Creative Commons license icon