Rails dev with WEBrick really slow in a VmWare Virtual Machine

Filed under: Development — lars @ 11:03:54 pm

I've been playing around with Ruby on Rails 3 in a linux Virtual Machine and I've found it **slow as hell**.

It turns out, that the rails development server WEBrick, by default, does a reverse DNS lookup for every incoming HTTP request on the IP address that makes the request.  This is fine when that IP address is localhost, but it's a problem when your machine is remote or virtual.

To fix this, you just need to find the config.rb file under /usr/local/rvm/rubies/ruby-1.9.2-p180/lib/ruby/1.9.1/webrick and change the following line from 'false' to 'true':

      :DoNotReverseLookup => true,

Back to work!


  • jay
    wow, that has been pissing me off for fucking ever-- thanks!!

    Comment by jay [Visitor] · http://lilx.net — 10/02/11 @ 09:36

  • Simmessa
    Very useful, that stupid slow motion operation was driving me nuts!



    Comment by Simmessa [Visitor] · http://simmessa.com — 12/28/11 @ 01:10

  • Zequez
    Oh My FSM!
    You are my freaking hero!
    I been strugling with this for months, I couldn't believe it was so slow. Installed rails-dev-tweaks, newrelic, everything, and I couldn't find out what was causing it.
    I can't belive I didn't found this long ago.

    Just, thanks.

    Comment by Zequez [Visitor] — 01/20/12 @ 00:52

  • Andrew
    I'm so freaking glad I found this!!!! Thank you so much now I will be able to sleep at night.

    Comment by Andrew [Visitor] — 02/25/12 @ 21:31

  • Ed Kelly
    Thank-you so much for this - I have Rails running in a Debian VM - server loads are now 10% of what they were without this fix.

    Comment by Ed Kelly [Visitor] · http://www.edkelly.co.uk — 03/13/12 @ 23:07

  • prusswan
    well done, now I can stop blaming vmware for no fault of its own:

    Comment by prusswan [Visitor] — 08/02/12 @ 03:33

  • David
    Props are due - thank you!

    Comment by David [Visitor] · http://www.xuvasi.com — 09/16/12 @ 02:29

  • Roberto
    Thanks man!, This really made my day; It's been a long time since this post, and I had to made it slightly different (as RVM is installed in another directory) but it still works fine.

    Comment by Roberto [Visitor] — 03/24/13 @ 08:11

  • Chut Yee
    The trick dose not work for rails 3.2.9. RoR is slow as hell again in ubuntu vm, windows 7 host. VirtualBox took 1 minute to refresh a page while VMWare took 30 seconds. The slowness is CPU bound. It is not funny to see ruby running at 97% CPU for 20 seconds.

    I ended up setting up a dual boot system with ubuntu.

    Comment by Chut Yee [Visitor] — 05/07/13 @ 11:23

  • Satish
    This is the exact solution for VMware issue, Thanks a lot...

    Comment by Satish [Visitor] — 05/15/13 @ 21:33

  • Ben Wilman
    Thanks, crucial. Fixed horrible performance with VirtualBox.

    Comment by Ben Wilman [Visitor] — 07/12/13 @ 09:03

Leave a comment

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>

(Line breaks become <br />)
(Set cookies for name, email & url)

powered by  b2evolution