2016-10-13

Apache BenchでConnection Refusedエラー

Apache Benchで以下のコマンドを入力したらエラーになった。

$ ab -c 10 -n 100 http://localhost:8080/  
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
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)...apr_socket_recv: Connection refused (61)

80ポートは通る。

$ ab -c 10 -n 100 http://localhost:80/ 
...
Percentage of the requests served within a certain time (ms)
  50%      2
  66%      3
  75%      3
  80%      3
  90%      4
  95%      6
  98%      6
  99%      6
 100%      6 (longest request)

原因はコレ↓

python - ab is erroring out with apr_socket_recv: Connection refused (61) - Stack Overflow

ということでlocalhost => 127.0.0.1に変更したら通った

$ ab -c 10 -n 100 http://127.0.0.1:8080/
...
Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      2
  80%      2
  90%      3
  95%      4
  98%      4
  99%      4
 100%      4 (longest request)
このエントリーをはてなブックマークに追加