Hi there,
I'm having some very slow responses on view rendering of the first load of a site after no requests have been made to the server say after 6 or so hours.
I've included some prod logs, and the Passenger configuration files (please see below) to show the 22 second delay.
Quick background:
a) the site redirects http requests to https.
b) the first request is to the root of the site, which responds in a slow 2.4 seconds before redirecting to the https version of the page,
c) it redirects, and the redirected view takes almost 22seconds to render.
d) subsequent hits to the site (even from another browser on a different network connection that has never visited the site before) now only takes on average 64ms!
Is this some sort of Passenger configuration problem? I've read and reread the Passenger configuration manual and I have set options to stop it from idling down any of the spawns and / or rails environment that may cause the slow lag after no requests for some time.
I've also utilised PassengerPreStart, and used MinInstances.
But none of this seems to cure this problem at all.
The server is also not using any swap. Here is the output from "free":
total used free shared buffers cached
Mem: 1023384 881020 142364 0 61940 188796
-/+ buffers/cache: 630284 393100
Swap: 905208 0 905208
Is there some Passenger/Apache configuration that I am missing?
Is there some OS thing that is affecting the performance? (Server is virtual machine - is the VM starved of cpu/disk resources perhaps?)
Have any of you experienced anything like this and/or know a way to resolve it?
Thanks and appreciate any help or suggestions
Cheers
Chris
Prod Logs:
----------------
Processing SiteController#index (for x.x.x.x at 2011-12-20 09:42:01) [GET]
Parameters: {"action"=>"index", "controller"=>"site"}
Filter chain halted as [:ensure_proper_protocol] rendered_or_redirected.
Processing SiteController#index (for x.x.x.x at 2011-12-20 09:42:06) [GET]
Parameters: {"action"=>"index", "controller"=>"site"}
Rendering template within layouts/general_layout
Rendering site/index
Processing SiteController#index (for x.x.x.x at 2011-12-20 09:43:03) [GET]
Parameters: {"action"=>"index", "controller"=>"site"}
Rendering template within layouts/general_layout
Rendering site/index
Passenger.conf:
-------------------------
<IfModule mod_passenger.c>
PassengerRoot /var/lib/gems/1.8/gems/passenger-3.0.9
PassengerRuby /usr/bin/ruby1.8
PassengerUseGlobalQueue On
PassengerSpawnMethod smart
PassengerFriendlyErrorPages Off
PassengerMinInstances 5
PassengerPoolIdleTime 0
PassengerHighPerformance on
PassengerLogLevel 0
RailsFrameworkSpawnerIdleTime 0
RailsAppSpawnerIdleTime 0
</IfModule>
In the individual site config I have:
--------------------------------------------------