Forum: Ruby on Rails slow ruby execution on FreeBSD

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
guy (Guest)
on 2007-04-21 17:18
(Received via mailing list)
Howdy,

Total green-horn here.  A few weeks ago, a test website we were
bulding (on freebsd with mysql) slowed waaaay down.

I **believe** I have the problem narrowed down to this line of code
in /vendor/rails/railties/lib/initializer.rb:
configuration.frameworks.each { |framework| require(framework.to_s) }

I Say I think I've got it narrowed doen to this line of code, because
I have it flanked by puts "AAA" and puts "BBB", and whenever I
execute:
config/environment.rb
there is a ~6 second pause between AAA and BBB to STDOUT.

Like I've said (and I'm sure you would have realized by now), I am a
total greenhorn here, but:
1) Is this pause to be expected, or have I stumbled upon the issue?
2) What does this line (configuration.frameworks.each { |framework|
require(framework.to_s) }) mean?  Can someone point me to the next
file/line to look?
3) Any ideas?

Also, I **believe** this is running with fastcgi, but how can I
confirm / troubleshoot this?

I really appreciate it!
Guy
Harald (Guest)
on 2007-04-22 22:10
guy wrote:
> Like I've said (and I'm sure you would have realized by now), I am a
> total greenhorn here, but:
> 1) Is this pause to be expected, or have I stumbled upon the issue?
> 2) What does this line (configuration.frameworks.each { |framework|
> require(framework.to_s) }) mean?  Can someone point me to the next
> file/line to look?

It will load (require) each of the files that make of the frameworks in
the configuration. You may probably further narrow it down by changing
the line as folows:

configuration.frameworks.each { |framework|
    puts "#{Time.now} loading: #{framework.to_s}"
    require(framework.to_s)
}

> 3) Any ideas?

May just be slow io, or maybe one of the required files takes a long
time to load?

> Also, I **believe** this is running with fastcgi, but how can I
> confirm / troubleshoot this?

Not sure about this one.

Take Care!
Harald!
guy (Guest)
on 2007-04-22 23:53
(Received via mailing list)
This is FANTASTIC, and you are a genious.  Now, can you tell me:

1) Is it normal (on a 3 gHz server with 32 GB of memory that is doing
NOTHING ELSE) that these would take ~ 2 seconds each?:
Sun Apr 22 12:52:34 -0700 2007 loading: active_record
Sun Apr 22 12:52:36 -0700 2007 loading: action_controller
Sun Apr 22 12:52:38 -0700 2007 loading: action_view

2) Where can I look to find these active_record, action_controller,
and action_view?  Are these files that I can drill down further into
to find where time is being spent?

Thanks Harald!!!
guy (Guest)
on 2007-04-22 23:54
(Received via mailing list)
This is FANTASTIC, and you are a genious.  Now, can you tell me:

1) Is it normal (on a 3 gHz server with 32 GB of memory that is doing
NOTHING ELSE) that these would take ~ 2 seconds each?:
Sun Apr 22 12:52:34 -0700 2007 loading: active_record
Sun Apr 22 12:52:36 -0700 2007 loading: action_controller
Sun Apr 22 12:52:38 -0700 2007 loading: action_view

2) Where can I look to find these active_record, action_controller,
and action_view?  Are these files that I can drill down further into
to find where time is being spent?

Thanks Harald!!!
Harald (Guest)
on 2007-04-24 02:23
guy wrote:
> This is FANTASTIC, and you are a genious.

Nah, just learning the language myself...

>  Now, can you tell me:
>
> 1) Is it normal (on a 3 gHz server with 32 GB of memory that is doing
> NOTHING ELSE) that these would take ~ 2 seconds each?:

Nope, that seems excessive. My system loads these (and two additional
frameworks easily in less than a second. (2GHz AMD Athlon 64 with 1 GB
RAM, FreeBSD 6.2).

What version of ruby do you have, and what version of rails?

> 2) Where can I look to find these active_record, action_controller,
> and action_view?  Are these files that I can drill down further into
> to find where time is being spent?

You should find them the vicinity of where you found the initializer.rb
file. In my case that is /usr/local/lib/ruby/gems/1.8/gems. There you
find subdirectories for rails, activerecord etc... I've installed ruby
and gems throught ports, and used gems to get rails.

Hope that will help you.

Harald!
This topic is locked and can not be replied to.