Rails incredibly slow (update)

After 24 minutes of waiting, the Welcome Aboard window came up in my
browser. The command window now contains

22:20:51.78 C:\InstantRails\rails_apps\demo>ruby script/server
=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment…

******** Here is where it stuck. What follows came out and then it
began to work. I don’t know whether there were delays between any of
the lines below.

** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. INT => stop (no restart).
** Mongrel available at 0.0.0.0:3000
** Use CTRL-C to stop.

Now going to the demo page proceeds at a normal pace in a new tab.
Going to rails/info/properties takes forever.

Advice? Thanks!

Ron J.
www.XProgramming.com

Ron J. wrote:

Now going to the demo page proceeds at a normal pace in a new tab.
Going to rails/info/properties takes forever.

Advice? Thanks!

Ron J.
www.XProgramming.com

Ron,

Are you on XP or Vista? Do you have an aggressive virus scanner than
scans every file each time it is accessed? You may need to look for a
way to disable scanning on the InstantRails directory.

Rails on Windows is slow - but not that bad (obviously).

Cheers,
Mohit.
11/14/2007 | 12:22 PM.

Ron J. wrote:

tonight.

Rails on Windows is slow - but not that bad (obviously).

Right … it works just fine on Chet’s machine.

I’ve run Ruby apps, including Rails apps, on an XP laptop with little
trouble. However, the times that Windows has been painfully slow
(whether I was running Ruby or not) tended (as best I could tell) to be
related to networking.

For example, browsing the file system would all too often stall File
Manager (or File Explorer or whatever it’s called) because the OS would
attempt to resolve mapped network drives and such. Seems the time-out
period is glacial, and until the OS is happy things come to a crawl.

(note: my Win32 SysAdmin skillz == Google + MSDN + ad hos experiments)

So, Dr. Anecdotal suggests looking to see if there are mapped drives
(either actually connected or not), references to network printers,
and so on.

James
Now on Kubuntu

On Tue, 13 Nov 2007 23:22:29 -0500, Mohit S.
[email protected] wrote:

Are you on XP or Vista? Do you have an aggressive virus scanner than
scans every file each time it is accessed? You may need to look for a
way to disable scanning on the InstantRails directory.

I’m on XP. I don’t think McAfee is that aggressive but I will check.
I’d have thought that other things would be just as slow if that were
the case though. I’ll report back if I find anything. Probably not
tonight.

Rails on Windows is slow - but not that bad (obviously).

Right … it works just fine on Chet’s machine.

Thanks,

Ron J.
www.XProgramming.com

On Wed, 14 Nov 2007 01:11:13 -0500, James B.
[email protected] wrote:

So, Dr. Anecdotal suggests looking to see if there are mapped drives
(either actually connected or not), references to network printers,
and so on.

Windows seems generally fine. Only rails has any particular slowness
showing. Thanks,

Ron J.
www.XProgramming.com

Ron J. wrote:

After 24 minutes of waiting, the Welcome Aboard window came up in my
browser. The command window now contains

Ron J.
www.XProgramming.com

Recently, I used this free tool to check some performance problems in my
Win box and i found some
problems fast that i wouldnt never dreamed.

http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/processmonitor.mspx

James B. wrote:

the case though. I’ll report back if I find anything. Probably not

James
Now on Kubuntu

My experience on Windows laptops (even more anecdotal than yours) is
that the hard drive is usually the bottleneck. And check your power
control settings – you might be running with 1/3 processor speed, with
the hard drive spinning up and down between web hits, or other bizarre
notions geared to battery conservation modes even when you’re plugged
into the wall.

But on my laptop, even though I run with everything at maximum speed
when plugged in, the hard drive is still beastly slow in Windows, so
it’s usually booted into Linux. :slight_smile:

On Wed, 14 Nov 2007 09:36:46 -0500, “M. Edward (Ed) Borasky”
[email protected] wrote:

My experience on Windows laptops (even more anecdotal than yours) is
that the hard drive is usually the bottleneck. And check your power
control settings – you might be running with 1/3 processor speed, with
the hard drive spinning up and down between web hits, or other bizarre
notions geared to battery conservation modes even when you’re plugged
into the wall.

But on my laptop, even though I run with everything at maximum speed
when plugged in, the hard drive is still beastly slow in Windows, so
it’s usually booted into Linux. :slight_smile:

The system runs quite well EXCEPT for rails, which takes upwards of 30
seconds to do “rails -h”. Nothing makes me think I have a general
performance problem.

Thanks,

Ron J.
www.XProgramming.com

The system runs quite well EXCEPT for rails, which takes upwards of 30
seconds to do “rails -h”. Nothing makes me think I have a general
performance problem.

I may have missed this in an earlier post, but what does running “ruby
-v”
from the command line do? Does it take 30 seconds or does it return the
Ruby version immediately?

Yours,

Tom

On Wed, 14 Nov 2007 11:42:17 -0500, Tanner B.
[email protected] wrote:

Does it happen running irb, or other normal ruby scripts, or is it
strictly related to rails?

Ruby -v (print the version) is a bit slower on my machine than Chet’s.
A ruby program counting to N is a small constant amount slower on my
machine, like one second slower no matter what N is, up to about
100,000.

A C# program counting to 1,000,000,000 runs the same on his machine
and mine.

When in the Rails ruby folder, we run
ruby runner.rb ruby
Chet’s machine takes about 6 seconds, and mine takes 93 seconds.

This is ruby tests, not rails. Other comparison tests our machines are
about the same, including a big loop in C#, starting visual studio,
starting eclipse, or starting Word. By and large, the machines run the
same speed. For Ruby, I’m 15x slower or worse.

Advise me, please. Thanks,

Ron J.
www.XProgramming.com

On Nov 14, 2007 9:15 AM, Ron J. [email protected] wrote:

But on my laptop, even though I run with everything at maximum speed
when plugged in, the hard drive is still beastly slow in Windows, so
it’s usually booted into Linux. :slight_smile:

The system runs quite well EXCEPT for rails, which takes upwards of 30
seconds to do “rails -h”. Nothing makes me think I have a general
performance problem.

Does it happen running irb, or other normal ruby scripts, or is it
strictly related to rails?

From: “Ron J.” [email protected]

When in the Rails ruby folder, we run
ruby runner.rb ruby
Chet’s machine takes about 6 seconds, and mine takes 93 seconds.

This may be like ‘slaking a thirst with a firehose’, but…

Maybe instrumenting runner.rb with a trace function:

def trace_on
trace_proc = proc do |event, file, line, id, binding, classname|
return if file =~ %r{lib/ruby/}
trace_str = sprintf( “%14.3f %8s %s:%-2d %10s %8s <%d>”,
Time.now.to_f, event, file, line, id,
classname, Thread.current.object_id )
$stderr.puts trace_str
end
set_trace_func trace_proc
end

def trace_off
set_trace_func nil
end

trace_on

… This will output a LOT of information, tracing each line
of code executed and printing a timestamp. But maybe it might
reveal something about where the slowdown is occurring. (If
the tracing itself doesn’t add so much overhead as to mask
the problem .)

Note that by default, to cut down on the spam, I have the trace
func ignore files having lib/ruby/ in their path. You may need
to modify that if you aren’t seeing the output you’re interested
in.

Hope this helps,

Bill

On Wed, 14 Nov 2007 14:03:36 -0500, Eric H. [email protected]
wrote:

$ time ruby -rsocket -e ‘p Socket.gethostbyname(“127.0.0.1”)’
[“localhost”, [“test”], 2, “\177\000\000\001”]

real 0m0.042s
user 0m0.010s
sys 0m0.009s

It’s a solid 8 seconds on my machine. But ordinary web page access is
nothing like that. What is this telling us?

Thanks,

Ron J.
www.XProgramming.com

On Nov 14, 2007, at 09:25 , Ron J. wrote:

When in the Rails ruby folder, we run
ruby runner.rb ruby
Chet’s machine takes about 6 seconds, and mine takes 93 seconds.

This is ruby tests, not rails. Other comparison tests our machines are
about the same, including a big loop in C#, starting visual studio,
starting eclipse, or starting Word. By and large, the machines run the
same speed. For Ruby, I’m 15x slower or worse.

This is making me think that your DNS is confused. I don’t know if
rails tries to do a name lookup, but it is probable. I’m sure that
ruby’s tests do socket lookups.

$ time ruby -rsocket -e ‘p Socket.gethostbyname(“127.0.0.1”)’
[“localhost”, [“test”], 2, “\177\000\000\001”]

real 0m0.042s
user 0m0.010s
sys 0m0.009s

Gamont Gamont wrote:

Recently, I used this free tool to check some performance problems in my
Win box and i found some
problems fast that i wouldnt never dreamed.

http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/processmonitor.mspx

Ron,

Is there any version of Ruby installed on your system other than the one
with InstantRails? What about Chet’s?

Also, the InstantRails directory has a file called use_ruby.cmd
Can you go to a command window, run use_ruby.cmd first and then type in
ruby -v
and then
rails -v
and see if it’s any faster.

Cheers
Mohit.

On Wed, 14 Nov 2007 22:27:46 -0500, Ron J. [email protected]
wrote:

It’s a solid 8 seconds on my machine. But ordinary web page access is
nothing like that. What is this telling us?

I flushed dns cache (windows xp), same result. changed from system
default DNS to some specific known DNS servers. Same result.

?

Ron J.
www.XProgramming.com

From: “Ron J.” [email protected]

real 0m0.042s
user 0m0.010s
sys 0m0.009s

It’s a solid 8 seconds on my machine. But ordinary web page access is
nothing like that. What is this telling us?

I flushed dns cache (windows xp), same result. changed from system
default DNS to some specific known DNS servers. Same result.

Weird. Not sure this would make any difference, but, might
try adding this at the beginning of your program:

require ‘resolv-replace’

It patches a pure-ruby DNS resolver implementation in place of
IPSocket#getaddress, etc., instead of using the blocking system
call.

Also, is nslookup.exe fast when invoked from a command prompt?

Regards,

Bill

On Wed, 14 Nov 2007 13:32:11 -0500, Bill K. [email protected] wrote:

This may be like ‘slaking a thirst with a firehose’, but…

If all else fails, I’ll dig into this one. Thanks,

Ron J.
www.XProgramming.com

On Nov 14, 2007, at 19:30 , Ron J. wrote:

It’s a solid 8 seconds on my machine. But ordinary web page access is
nothing like that. What is this telling us?

Do you get the same result for the IP address (last field)?

I have seen problems where DNS is confused only for 127.0.0.1 or
localhost which leads to this terrible delay. Adding an entry to the
hosts file sometimes fixes this, but I’m not sure where it lives on
windows systems.

On Wed, 14 Nov 2007 22:59:29 -0500, Bill K. [email protected] wrote:

Weird. Not sure this would make any difference, but, might
try adding this at the beginning of your program:

require ‘resolv-replace’

It patches a pure-ruby DNS resolver implementation in place of
IPSocket#getaddress, etc., instead of using the blocking system
call.

“My program” is rails, so I’m not sure I could do that.

Also, is nslookup.exe fast when invoked from a command prompt?

Instantaneous.

Weird …

Ron J.
www.XProgramming.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs