The first request to a Rails application is very slow

always the first request (working session) to my Rails application lags. Switching to production mode does not help.

I use mongrel, and other requests are processed at an acceptable speed.

How to make it faster?

Hello

+5
source share
5 answers

If you publish the contents of the log as the first request is processed, we may be able to figure out what makes it so slow. For example, this is my journal, since the first user accesses the site

Booting Mongrel (use 'script/server webrick' to force WEBrick)    
Rails 2.1.0 application starting on http://0.0.0.0:3000    
Debugger enabled    
Call with -d to detach    
Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/mime_type.rb:66: warning: already initialized constant CSV
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.


Processing SessionsController#new (for 127.0.0.1 at 2009-05-26 12:26:00) [GET]
  Session ID: de2acf074759026e1ed6205724f547a9
  Parameters: {"action"=>"new", "controller"=>"sessions"}
Rendering sessions/new
Completed in 0.00587 (170 reqs/sec) | Rendering: 0.00298 (50%) | DB: 0.00092 (15%) | 200 OK [http://localhost/]

, 170 / , . , , , - HTML . , , .

, , , , , curl. , .

+1

, , Websphere.

WAS ( WAS).

, , , WAS, ( ) . , .

, Ruby . .

+1

, Ferret ? , ? , , db, view , 10 . - , , .

+1

, :

  • ( )

  • , ,

.

+1

Perhaps you need to configure PassengerPoolIdleTimevar in apache conf. Set it to 0 to never stop the rails process.

0
source

All Articles