I have a rails app sitting on an Ubuntu 9.10 server located here:


If you hit it initially, it takes about 4 seconds to do its initial load. Once the load has happened the server response nearly instantly. Any thoughts as to why the initial http request is so slow? It definitely shouldn't be loading this slowly the first time especially since its near pure text with zero DB calls.

Here's some info:

Ruby 1.9.1-p376 Rails 2.3.5 Gem 1.3.5 MySQL 5.1

  • serverfault.com/questions/100257/… I did find this, any thoughts on it? – Justin Feb 10 '10 at 2:13
  • What are you using as the webserver? May I suggest a mongrel cluster/Thin/mod_rails? – Scott Markwell Feb 10 '10 at 2:14
  • I was able to reproduce it continuously like this: 1. Restart Apache 2. Visit webpage Watching it on htop, root starts Passenger spawn server which looks like it launches Rails: /var/www/<location of website>/, and it eats up 100% cpu until it's loaded. It can take upwards of 7 seconds. Is this normal? – Justin Feb 10 '10 at 2:20
  • @scott - Yeah this is a AWS web server. It's using Apache, Passenger. – Justin Feb 10 '10 at 2:21


Found my question. Thanks guys for anyone who looked at this.

| improve this answer | |

You should update your original question to include information such as AWS, Apache HTTPd and Mod_Rails/Phusion Passenger.

To answer your question, you should read Phusion Passenger's Apache HTTPd documentation on Spawn settings.


It sounds like you are in conservative spawning mode, and additionally, the first node is not spawned until the first request is made to the site. So I am not surprised that it is taking 7 seconds for the full rails environment to be loaded from disk, injected into a ruby vm, and setup.

You should also look at the RailsAppSpawnerIdleTime and make sure it is suitable high, so your spawned rails instances do not get recycled. I'm assuming this is a dedicated AWS instance for the express purpose of hosting this site, so this should most likely be set to 0 (to disable) with a max number of nodes that can be spawned.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy