Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What's happening is that your Application and/or ApplicationSpawners are shutting down due to time-out. To process your new request, Passenger has to startup a new copy of your application, which can take several seconds, even on a fast machine. To fix the issue, there are a few Apache configuration options you can use to keep your Application alive. </p> <p>Here's specifically what I've done on my servers. The PassengerSpawnMethod and PassengerMaxPreloaderIdleTime are the configuration options most important in your situation.</p> <pre><code># Speeds up spawn time tremendously -- if your app is compatible. # RMagick seems to be incompatible with smart spawning # Older versions of Passenger called this RailsSpawnMethod PassengerSpawnMethod smart # Keep the application instances alive longer. Default is 300 (seconds) PassengerPoolIdleTime 1000 # Keep the spawners alive, which speeds up spawning a new Application # listener after a period of inactivity at the expense of memory. # Older versions of Passenger called this RailsAppSpawnerIdleTime PassengerMaxPreloaderIdleTime 0 # Just in case you're leaking memory, restart a listener # after processing 5000 requests PassengerMaxRequests 5000 </code></pre> <p>By using "smart" spawning mode and turning off PassengerMaxPreloaderIdleTime, Passenger will keep 1 copy of your application in memory at all times (after the first request after starting Apache). Individual <code>Application</code> listeners will be <code>fork</code>ed from this copy, which is a super-cheap operation. It happens so quickly you can't tell whether or not your application has had to spawn a listener.</p> <p>If your app is incompatible with smart spawning, I'd recommend keeping a large PassengerPoolIdleTime and hitting your site periodically using curl and a cronjob or monit or something to ensure the listener stays alive.</p> <p>The <a href="http://www.modrails.com/documentation.html" rel="noreferrer">Passenger User Guide</a> is an awesome reference for these and more configuration options.</p> <p><strong>edit</strong>: If your app is incompatible with smart spawning, there are some <strong>new options</strong> that are very nice</p> <pre><code># Automatically hit your site when apache starts, so that you don't have to wait # for the first request for passenger to "spin up" your application. This even # helps when you have smart spawning enabled. PassengerPreStart http://myexample.com/ PassengerPreStart http://myexample2.com:3500/ # the minimum number of application instances that must be kept around whenever # the application is first accessed or after passenger cleans up idle instances # With this option, 3 application instances will ALWAYS be available after the # first request, even after passenger cleans up idle ones PassengerMinInstances 3 </code></pre> <p>So, if you combine PassengerPreStart and PassengerMinInstances, Passenger will spin up 3 instances immediately after apache loads, and will always keep at least 3 instances up, so your users will rarely (if ever) see a delay.</p> <p>Or, if you're using smart spawning (recommended) with <code>PassengerMaxPreloaderIdleTime 0</code> already, you can add <code>PassengerPreStart</code> to get the additional benefit of immediate startup.</p> <p>Many thanks to the heroes at <a href="http://www.phusion.nl/" rel="noreferrer">phusion.nl</a>!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload