sun*_*ity 6 ruby thin apachebench
可能重复:
'ab'程序在很多请求后冻结,为什么?
这是一个简单的测试服务器:
require 'rubygems'
require 'rack'
require 'thin'
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, "OK"]
end
end
Rack::Handler::Thin.run HelloWorld.new, :Port => 9294
#I've tried with these added too, 'rack.multithread' => true, 'rack.multiprocess' => true
Run Code Online (Sandbox Code Playgroud)
这是一个测试运行:
$ ab -n 20000 http://0.0.0.0:9294/sdf
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 0.0.0.0 (be patient)
Completed 2000 requests
Completed 4000 requests
Completed 6000 requests
Completed 8000 requests
Completed 10000 requests
Completed 12000 requests
Completed 14000 requests
Completed 16000 requests
apr_poll: The timeout specified has expired (70007)
Total of 16347 requests completed
Run Code Online (Sandbox Code Playgroud)
它在16500左右发生故障.为什么?我怎样才能知道发生了什么.是红宝石中的GC还是OS X机器上有多个可用网络套接字的东西.我有一个MPB 2.5 Ghz 6G内存.
编辑
经过一些讨论和测试各种事情后,似乎将net.inet.tcp.msl从15000更改为1000毫秒,使得测试高频Web服务器的问题随之消失.
sudo sysctl -w net.inet.tcp.msl=1000 # this is only good for local development
Run Code Online (Sandbox Code Playgroud)
请参阅引用的问题以及此问题的答案.'ab'程序在收到大量请求后会冻结,为什么?
为了清楚起见,我会在这里添加解决方案.使用ab on os X进行高频测试的正确解决方案是将'net.inet.tcp.msl'设置从15000ms更改为1000ms.这应该只在开发盒上完成.
sudo sysctl -w net.inet.tcp.msl=1000 # this is only good for local development
Run Code Online (Sandbox Code Playgroud)
这个答案是在这里的评论中进行了很好的侦探工作之后找到的,来自一个非常相似的问题的答案,这里是答案:https://stackoverflow.com/a/6699135/155031
| 归档时间: |
|
| 查看次数: |
1921 次 |
| 最近记录: |