[英]Slow localhost load running Rails and Webrick
I am running Rails on in my development environment and Webrick is unbearably slow. 我正在开发环境中运行Rails,Webrick的运行速度令人难以忍受。 I am not really able to find out why.
我真的不知道为什么。
The CPU utilization bounces between 6 and 12%, and the memory utilization hovers at 18% throughout the load. 在整个负载中,CPU利用率在6%到12%之间反弹,而内存利用率则在18%左右徘徊。
I found a website where the author recommended changing the webrick config (...\\lib\\ruby\\2.0.0\\webrick\\config.rb): 我在一个网站上发现了作者建议更改webrick配置的网站(... \\ lib \\ ruby \\ 2.0.0 \\ webrick \\ config.rb):
General + {
...
#:DoNotReverseLookup => nil, #original setting
:DoNotReverseLookup => true,
}
I also rebooted my box in case something like that was the solution, but no change. 我也重新启动了我的盒子,以防出现类似的情况,但是没有任何变化。
Here is the load: 这是负载:
What is causing this slow load and how do I fix it? 是什么导致这种缓慢的负载,我该如何解决?
Edit: I am using a Windows 7 dev environment, 24 GB, 3.1 GHz, running postgres. 编辑:我正在使用Windows 7开发环境,24 GB,3.1 GHz,运行postgres。
WEBrick is doing a reverse DNS lookup on connecting IPs by default. 默认情况下,WEBrick正在对连接的IP进行反向DNS查找。 In other words, it's trying to see if your IP address is associated with a domain name.
换句话说,它试图查看您的IP地址是否与域名相关联。 This is unnecessary and takes too long, so you can disable it.
这是不必要的,并且花费的时间太长,因此可以将其禁用。
Open the file "l/ruby/lib/ruby/1.9.1/webrick/config.rb"
and locate the line with ":DoNotReverseLookup => nil"
. 打开文件
"l/ruby/lib/ruby/1.9.1/webrick/config.rb"
然后通过":DoNotReverseLookup => nil"
找到该行。 Change nil
to true
. 将
nil
更改为true
。
Enjoy! 请享用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.