How to improve my response speed?

I recently found my web application responses very slowly:
When the address has been inputed in the browser locally,I can see in
the console that Webrick or Mongrel will have no information output for
about 7-10 seconds,and after this wait, then the javascripts are started
to be downloaded and then the controller start to response.What is the
most possible one that lead to this 7-10 seconds’ wait? Thanks.

btw:
My web application has a very simple route.rb:
ActionController::Routing::Routes.draw do |map|
map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’
map.connect ‘’, :controller => ‘articles’, :action => ‘index’
map.connect ‘:controller/:action/:id’
end

and what’s more, My web application has used some plugins including:
Login-Engine, and file_column.

Best Regards
Andy

On Thu, 2006-08-17 at 12:44 +0200, Andy wrote:

I recently found my web application responses very slowly:
When the address has been inputed in the browser locally,I can see in
the console that Webrick or Mongrel will have no information output for
about 7-10 seconds,and after this wait, then the javascripts are started
to be downloaded and then the controller start to response.What is the
most possible one that lead to this 7-10 seconds’ wait? Thanks.

Andy, the list of things to check (from memory) are:

  1. Are you sure you’re running in production mode?
  2. Are you configured so that Mongrel doesn’t serve static files in
    production? (this involves rewrite rules for most web servers).
  3. Do you have enough memory for all your running applications? If
    you’re on a VPS and you’re running a lot of other software (especially
    MySQL) then you can get a lot of swapping.
  4. Is it fast by itself, but slow behind the front server? This could
    mean your front server is misconfigured.
  5. Are you using a crappy DNS that’s really slow? Try using IP
    addresses for your configurations (database, web server backends, etc.).
  6. Are you on windows? Sorry, Ruby on windows is painfully slow.
  7. Are you on older FreeBSD? Original FreeBSD compiled Ruby with
    pthreads enabled which made it very very slow. Go into ports and
    compile ruby18-nopthreads.

Check those out, and if it’s none of those then it’s your code. Read
about the benchmark library in Ruby and use it to find out what’s slow.
Also look in the production.log for timing messages (there’s a goldmine
there) and see what you can do to make that faster.


Zed A. Shaw

http://mongrel.rubyforge.org/
http://www.railsmachine.com/ – Need Mongrel support?