Windows Production Apache Cluster. Mongrel sleeps

When running production mode on Windows 2003 using Apache and a proxy
balancer mod and mod_rewrite to redirect to the mongrel instances, I
sometimes get a Proxy Error thrown from Apache.

Setup is done according to this guide:

4 Mongrel processes run as Windows Services on high ports (4000+)

VHost entry:

<Proxy balancer://ruby_cluster>

<VirtualHost *:80>
ServerName ************
DocumentRoot C:/websites/***********/

<Directory C:/websites/**********/public/ >
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ErrorLog C:/websites/**********/log/apache_error.log
LogLevel warn

CustomLog C:/websites/**********/log/apache_access.log combined

RewriteEngine On

Check for maintenance file and redirect all requests

RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]

Rewrite index to check for static

RewriteRule ^/$ /index.html [QSA]

Rewrite to check for Rails cached page

RewriteRule ^([^.]+)$ $1.html [QSA]

Redirect all non-static requests to cluster

RewriteRule ^/(.*)$ balancer://ruby_cluster%{REQUEST_URI} [P,QSA,L]

Now this all works fine. Apache gets hit on port 80 like normal and
redirects its request to one of the 4 mongrel services which will render
the appropriate response.

However when the website hasn’t seen traffic in a long while, lets say
roughly 24 hours, the first hit always results in a 502 Proxy Error from

Proxy Error

The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET /.

Reason: Error reading from remote server

Refreshing the page will display the ruby generated page correctly

It seems that Mongrel falls asleep or something like that and will react
either too late or with an invalid response when queried by Apache.

Does anyone have any advice on how to counter this problem?

Anyone got any idea on how to tackle this problem?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs