JRuby on Rails runs slow on Win 7

I have been working with a medium-sized JRoR app on Win 7 for quite
some time and it was slow and unresponsive since day 1. At first I
thought it’s due to poor DB interaction code in our app, but a few
days ago I created a blank JRoR app and noticed that it’s just as slow
and unresponsive. Loading the default home page takes around 2 secs
for the first and all the subsequent times. Running the app in the
–server mode and production environment does not fix the problem.

Today I profiled the app with VisualVM and looks like it spends most
of its time in org.jruby.RubyThread.select. The snapshot file is
available for download at:
http://dl.dropbox.com/u/34024/JRuby%20on%20Rails%20Runs%20Slow%20on%20Win%207.nps

Any ideas what’s causing this and how can it be fixed?

The same app using the same JRuby version (1.5.2) runs fine and very
smoothly on OS X SL.

Cheers,
Behrang S.

Just googled a bit more and looks like it has to do with mongrel
binding to 0.0.0.0. Binding to 127.0.0.1 and going to 127.0.0.1:3000
rather than localhost:3000 fixed the problem.

Cheers,
Behrang S.

An alternative solution is to uncomment

127.0.0.1 localhost

in your hosts file.

Cheers,
Behrang S.

It may be related to

BasicSocket.do_not_reverse_lookup

Being set to false by default in 1.8

-r