0

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

  • http://serverfault.com/questions/100257/rails-environment-takes-a-long-time-to-start-in-on-vm I did find this, any thoughts on it? –  Feb 10 '10 at 02:13
  • What are you using as the webserver? May I suggest a mongrel cluster/Thin/mod_rails? – Scott Markwell Feb 10 '10 at 02: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//, and it eats up 100% cpu until it's loaded. It can take upwards of 7 seconds. Is this normal? –  Feb 10 '10 at 02:20
  • @scott - Yeah this is a AWS web server. It's using Apache, Passenger. –  Feb 10 '10 at 02:21

2 Answers2

0

https://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.

0

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.

Scott Markwell
  • 722
  • 1
  • 6
  • 13