Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

http://sandbox.incolo.com

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

share|improve this question
    
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
add comment

2 Answers

up vote 0 down vote accepted

http://stackoverflow.com/questions/853532/slow-initial-server-startup-when-using-phusion-passenger-and-rails/854870

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

share|improve this answer
add comment

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.

http://www.modrails.com/documentation/Users%20guide%20Apache.html#RailsSpawnMethod

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.