httperf 总是收到“连接被拒绝”的错误信息(MacOS)

httperf 总是收到“连接被拒绝”的错误信息(MacOS)

我想使用 httperf 作为开发 RubyOnRails 站点的基准测试工具。但它总是显示“连接被拒绝”,我不知道为什么。

12:24 $ httperf localhost --port=3000 -v -d10
httperf --verbose --client=0/1 --server=localhost --port=3000 --uri=/ --send-buffer=4096 --recv-buffer=16384 --ssl-protocol=auto --num-conns=1 --num-calls=1
httperf: maximum number of open descriptors = 8000
event_signal: EV_HOSTNAME_LOOKUP_STOP (obj=0x0,arg=102fc050b)
event_signal: EV_SESS_NEW (obj=0x0,arg=102fc050b)
timer_schedule: t=0x7fd828403fe0, delay=5s, subject=0
event_signal: EV_CONN_CONNECTING (obj=0x7fd828808000,arg=0)
event_signal: EV_CONN_CONNECTED (obj=0x7fd828808000,arg=0)
event_signal: EV_CONN_CLOSE (obj=0x7fd828808000,arg=0)
event_signal: EV_CALL_ISSUE (obj=0x7fd8284049d0,arg=0)
event_signal: EV_CALL_SEND_START (obj=0x7fd8284049d0,arg=0)
event_signal: EV_CALL_SEND_RAW_DATA (obj=0x7fd8284049d0,arg=0)
event_signal: EV_CALL_SEND_STOP (obj=0x7fd8284049d0,arg=0)
do_send.0: wrote -1 bytes on 0x7fd828808000
httperf.do_send: writev() failed: Connection refused
event_signal: EV_CONN_TIMEOUT (obj=0x7fd828808000,arg=3d)
httperf.core_close(conn=0x7fd828808000)
event_signal: (null) (obj=0x7fd8284049d0,arg=0)
event_signal: EV_CONN_DESTROYED (obj=0x7fd828808000,arg=0)
event_signal: EV_CONN_FAILED (obj=0x7fd828808000,arg=0)
Maximum connect burst length: 0

Total: connections 1 requests 0 replies 0 test-duration 0.000 s

Connection rate: 15592.2 conn/s (0.1 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 0.0 avg 0.0 max 0.0 median 0.0 stddev 0.0
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 0.000

Request rate: 0.0 req/s (0.0 ms/req)
Request size [B]: 0.0

Reply rate [replies/s]: min 0.0 avg 0.0 max 0.0 stddev 0.0 (0 samples)
Reply time [ms]: response 0.0 transfer 0.0
Reply size [B]: header 0.0 content 0.0 footer 0.0 (total 0.0)
Reply status: 1xx=0 2xx=0 3xx=0 4xx=0 5xx=0

CPU time [s]: user 0.00 system 0.00 (user 43.7% system 59.3% total 102.9%)
Net I/O: 0.0 KB/s (0.0*10^6 bps)

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

我可能做错了什么?系统是 MacOS 10.8.5,httperf 是从源代码构建的。

12:39 $ httperf --verbose --version
httperf: httperf-0.9.1 compiled Feb  9 2016 with DEBUG without TIME_SYSCALLS.

更新:围攻也收到“连接被拒绝”的信息:

13:57 $ curl localhost:3000 > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 16974    0 16974    0     0  35020      0 --:--:-- --:--:-- --:--:-- 35070
13:57 $ siege -g http://localhost:3000/
[error] socket: 11231232 connection refused.: Connection refused
[done]

答案1

似乎问题出在“localhost”——如果我使用 127.0.0.1,一切就正常。

相关内容