I've got a simple Rails application used on the 500 Megabytes Slicehost VPN. I am the only person who uses the application. After I run it on my small laptop, it's fast enough. However the used version is insanely slow. It take six to ten seconds to load the login screen.

I must discover why it is so slow. Could it be my code? (Don't believe so since it is considerably faster in your area, but maybe.) Could it be Slicehost's server being overloaded? Could it be the web?

Can someone advise a technique or group of steps I'm able to decide to try help limit the reason for this issue?


Sorry didn't remember to say. I am running it under CentOS 5 using Phusion Passenger (Also known as mod_rails or mod_rack).

If it's just slow on the very first time you load it's most likely due to passenger killing the procedure because of lack of exercise. I do not remember all of the particulars however i do recall reading through individuals who used cron jobs to help keep a minumum of one process alive to avert this lag that may occur with passenger required to reload the atmosphere.

Edit: more particulars here

Particularly - pool idle time defaults to two minutes meaning after two minutes of idling passenger would need to reload the atmosphere for everyone the following request.

First, discover if there is a particularly slow response in the server. Use Opera and also the Firebug wordpress plugin to determine how lengthy each component (including JavaScript and graphics) takes to download. Presuming the primary page is what's taking constantly, you can begin profiling the applying. You will need to find the best profiler, so that as I do not really operate in Ruby on Rails, I can not suggest any: google "profile ruby on rails" for many options.

As YenTheFirst highlights, the server software and config you are using may lead to some downturn, but A) slicehost does not determine that, you need to do, as Slicehost just provides very raw server "slices" that you could treat as devoted machines. B) you are unlikely to determine a script that runs instantly all of a sudden take 6 seconds simply because it's running as CGI. Another thing should be happening. Check just how much RAM you are using: perhaps you have gone into swap? May be the login slow only the very first time it's hit showing some startup problem, or perhaps is it always that slow? Is static content offered slow? That'd often mean some network problem (either around the Slicehost side, or perhaps your local network) is slowing down things lower, presuming you are not in swap.

Whenever you say "fast enough" you are being vague: does laptops version take 1 second towards the Slicehost 6? That would not be entirely surprising, when the laptop is decent: in the end, the main reason slices are cheap happens because they are a part of a full server. You are using most likely 1/32 of the 8 core machine at Slicehost, instead of both cores of the modern laptop. The Slicehost cores are quick, however your laptop might be a screamer in comparison to at least oneOr4 of core. :)

Attempt to pint point in which the slowness lies

1/ application is slow, or infrastructure (network + web server)

  • put a static file in your web server, and can get on using your browser

2/ If it's fast, it's probable an issue with application + server configuration.

  • database access is slow
  • consider using a page having a simpel loop: could it be slow?

3/ Whether it slow, it's most likely your infrastructure. You should check:

  • bad network connection: perform a packet capture (with Wireshark for instance) and search for retransmissions, duplicate packets, etc.
  • DNS resolution is slow?
  • server is misconfigured?
  • etc.