简体   繁体   中英

Slow localhost load running Rails and Webrick

I am running Rails on in my development environment and Webrick is unbearably slow. 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.

I found a website where the author recommended changing the webrick config (...\\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.

WEBrick is doing a reverse DNS lookup on connecting IPs by default. In other words, it's trying to see if your IP address is associated with a domain name. 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" . Change nil to true .

Enjoy!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM