# Slow ruby execution on FreeBSD

**URL:** <https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609>\
**Category:** Rails\
**Created:** [April 21, 2007, 3:18pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609 "2007-04-21T15:18:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 21, 2007, 3:18pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609/1 "2007-04-21T15:18:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 22, 2007, 8:10pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609/2 "2007-04-22T20:10:35Z")

</div>

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)  
}

> 1. 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!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 22, 2007, 9:53pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609/3 "2007-04-22T21:53:40Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 22, 2007, 9:54pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609/4 "2007-04-22T21:54:40Z")

</div>

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!!!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [April 24, 2007, 12:23am UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92609/5 "2007-04-24T00:23:28Z")

</div>

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?

> 1. 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!
