# Slow ruby execution on FreeBSD

**URL:** <https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598>\
**Category:** Ruby\
**Created:** [April 21, 2007, 8:57am UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598 "2007-04-21T08:57:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Guy\_S](https://www.ruby-forum.com/u/Guy_S)\
**Post date:** [April 21, 2007, 8:57am UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598/1 "2007-04-21T08:57:39Z")

</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?

I really appreciate it!  
Guy

---

<div class="post-metadata">

**Author:** ![Guy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Guy\_S](https://www.ruby-forum.com/u/Guy_S)\
**Post date:** [April 21, 2007, 2:37pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598/2 "2007-04-21T14:37:07Z")

</div>

Guy S. wrote:

> 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) }  
> You’re probably going to get better advice on the Rails list:  
> [Ruby on Rails — A web-app framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern.](http://www.rubyonrails.org/community)

Good luck!

---

<div class="post-metadata">

**Author:** ![Guy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Guy\_S](https://www.ruby-forum.com/u/Guy_S)\
**Post date:** [April 21, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598/3 "2007-04-21T14:38:07Z")

</div>

On Sat, Apr 21, 2007 at 03:56:38PM +0900, Guy S. wrote:

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

Rails does indeed have a long startup time. But normally it doesn’t  
matter,  
because the same instance should remain around to handle subsequent  
requests.

So it sounds like you’ve broken something else, such that either Rails  
can’t  
start at all, or it starts, handles one (or a few) requests, and then  
terminates.

Debugging this would depend on exactly how you’re running rails, e.g.  
under  
fastcgi, or under mongrel, or webrick. I suggest you go to the Rails  
google  
group for advice, since this is the Ruby Language list, not the Rails  
group.

Regards,

Brian.

P.S. Don’t run rails as a normal CGI. This will _guarantee_ a 6-second  
startup overhead for every page request.

---

<div class="post-metadata">

**Author:** ![Guy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Guy\_S](https://www.ruby-forum.com/u/Guy_S)\
**Post date:** [April 21, 2007, 3:11pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598/4 "2007-04-21T15:11:09Z")

</div>

Thanks Brian,

I will check out the rails side.

Can you tell me (or point me to a faq) what the difference between rails  
&  
ruby is? Also, I think this is running fastcgi, but how would I know  
for  
sure?

thanks,  
Guy

Brian C. writes:

---

<div class="post-metadata">

**Author:** ![Guy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Guy\_S](https://www.ruby-forum.com/u/Guy_S)\
**Post date:** [April 21, 2007, 3:20pm UTC](https://www.ruby-forum.com/t/slow-ruby-execution-on-freebsd/92598/5 "2007-04-21T15:20:09Z")

</div>

Guy S. wrote:

> Thanks Brian,  
> I will check out the rails side.  
> Can you tell me (or point me to a faq) what the difference between rails  
> & ruby is?

Rails is a framework for website creation, written in the Ruby scripting  
language.

> Also, I think this is running fastcgi, but how would I know  
> for sure?

Shot into the dark: Check your webserver configuration?

–  
Phillip “CynicalRyan” Gawlowski  
[http://cynicalryan.110mb.com/](http://cynicalryan.110mb.com/)  
[http://clothred.rubyforge.org](http://clothred.rubyforge.org)

Rule of Open-Source Programming #15:

If you like it, let the author know. If you hate it, let the author  
know why.
