[Nitro] Nitro on Apache

Robert Mela rob at robmela.com
Wed Oct 3 09:25:49 EDT 2007


I'm preparing a lengthy how-to.  I've spent many pressured hours on at 
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

NB: There's a major problem with the way Mongrel 1.0.1 handles 
connection limits.  If it's over it's configured connection limit It 
accepts, then immediately closes with no processing.  Things would work 
much better with mod_proxy_balancer if monger were modified ( perhaps 
configurably ) to simply not call accept() when it's reached its 
configured connection limit.

The problem is less likely to be triggered if Mongrel is running Nitro, 
but it's still a flaw.   It's a MAJOR headache on a busy Rails site with 
slow-loading pages.

For details on mod_proxy and mod_proxy_balancer, look at 
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html

There's also the mod_rewrite trick for handling static files -- cuts 
request times from tens of milliseconds to tenths of milliseconds, and 
with a lot less CPU -- very important on asset-heavy, busy sites... see 
the RewriteCond...

    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f
    RewriteRule (.*) $1 [L]
    ProxyPass / balancer://myserverpool/   #### NB: trailing slash
    ProxyPassReverse / balancer://myserverpool/  ### NB: trailing slash
    ProxyPreserveHost on


<Proxy balancer://myserverpool > # no trailing slash
    BalancerMember http://192.168.10.10:10000 keepalive=on max=10 
lbset=0 timeout=1
    BalancerMember http://192.168.10.10:10001 keepalive=on max=10 lbset=1
    BalancerMember http://192.168.10.11:10000 keepalive=on max=10 
lbset=0 timeout=1
</Proxy>


I've also got a Apache module that I'm polishing up that very simply 
handles very large hashed directory caches ( millions of entries ).  
Very useful for rails on large sites:

   http://myapp.mysite.net/image/1782.gif
or
   /myappdir/public/image/1/7/8/2/1782.gif.cache


George Moschovitis wrote:
> I use Apache + mod_proxy_ballancer + Mongrel.
>
> I will try to prepare a *short* tutorial.
>
> -g.
>
>
>
> On 10/3/07, *Arne Brasseur* < arne at arnebrasseur.net 
> <mailto:arne at arnebrasseur.net>> wrote:
>
>     I'm for the first time trying to actually deploy a Nitro app on my
>     shared hosting account. I'm trying to use FastCGI since that's what I
>     had success with using Rails. It took some tweaking of the FastCGI
>     adapter, it seems unmaintained.
>
>     I'm mainly stealing ideas from Rails here, I created a dispatch.fcgi
>     that just loads Nitro, sets the mode to :live and requires app.rb.
>     If I
>     run it gives the two green lines :
>
>     03/10 05:13:11  INFO: Og uses the Mysql store.
>     03/10 05:13:11  INFO: Starting Fastcgi server in live mode,
>     listening at
>     0.0.0.0:9000 <http://0.0.0.0:9000>
>
>     My .htaccess should be good. Now if I visit the site I get a
>     server 500
>     error. The error log mentions :
>
>     [Wed Oct 03 05:11:59 2007] [error] [client 61.225.17.58
>     <http://61.225.17.58>] FastCGI:
>     incomplete headers (0 bytes) received from server "/home/ar
>     nebrasseur/subdomains/vocab/dispatch.fcgi"
>
>     Have other people gotten this to work? Do I have other options having
>     only limited control over the apache configuration?
>
>     Thanks for any pointers!
>
>     (ab)
>
>     --
>     Arne Brasseur
>     http://www.arnebrasseur.net
>     arne at arnebrasseur.net <mailto:arne at arnebrasseur.net>
>
>     _______________________________________________
>     Nitro-general mailing list
>     Nitro-general at rubyforge.org <mailto:Nitro-general at rubyforge.org>
>     http://rubyforge.org/mailman/listinfo/nitro-general
>
>
>
>
> -- 
> http://gmosx.me.gr
> http://phidz.com
> http://blog.gmosx.com
> http://cull.gr
> http://www.joy.gr
> http://nitroproject.org
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20071003/f1e11ab1/attachment.vcf 


More information about the Nitro-general mailing list