# Completely confused and overwhelmed ! :(

**URL:** <https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811>\
**Category:** Deployment\
**Created:** [April 12, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811 "2007-04-12T15:58:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 3:58pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/1 "2007-04-12T15:58:22Z")

</div>

Hi,

I’ve been looking into deployment for a rails app for a week and I  
have to say I’m totally overwhelmed by the options! The main problem  
is I can’t use Apache 2.2, only 2.0.

I’m sold on mongrel and clustering with it. But what to use for a  
balancer and static file server?

I’m messing with LightTPD, seems to be working but I just read on the  
NGINX site that it leaks 20MB/hour? Yikes. Can’t have that.

NGINX looks promising, but what kind of support is there? Can I tell  
our sys admins that it’s OK and nothing to worry about?

I don’t think I can do Apache because it doesn’t do load balancing on  
2.0.

What should I do? The main concern is that whatever setup I choose, it  
needs to be as light weight as possible and almost invisible to the  
rest of the server in terms of strain.

Should we just let Mongrel serve static content and use Pound or  
Balance?

Thanks for any help or recommendations. What I’d love to see (wishful  
thinking) is a list of pros and cons of each valid setup.

Matt

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/2 "2007-04-12T16:15:26Z")

</div>

goodieboy wrote:

> NGINX site that it leaks 20MB/hour? Yikes. Can’t have that.
> 
> Should we just let Mongrel serve static content and use Pound or  
> Balance?
> 
> Thanks for any help or recommendations. What I’d love to see (wishful  
> thinking) is a list of pros and cons of each valid setup.
> 
> Matt

You could try Apache 2.0 -\> Pen -\> Mongrel pack. I’ve had some success  
with it.

> >

–  
Jack C.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 4:33pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/3 "2007-04-12T16:33:27Z")

</div>

So Apache would use rewrite to check for static files? Would you mind  
posting your config files etc.? Thanks for you recommendation!

Matt

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 4:58pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/4 "2007-04-12T16:58:29Z")

</div>

There is always rewritemap-based proxying using a rnd: map to select  
the port to proxy to. I use this with some sucess, admittedly on  
relatively low-traffic sites. I’ll probably add in Pen if the use of  
the map became an issue.

(I still need Apache’s rewrite rules because of another requirement  
for rewrite maps, otherwise I’d probably be using nginx to deal with  
static files as well.)

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 5:26pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/5 "2007-04-12T17:26:32Z")

</div>

You could always use Pound in front as your load balancer, and then  
direct  
static files to Apache, and dynamic to a mongrel cluster. Part of this  
depends on whether you can create the configuration in Pound so as to  
determine the difference between static and dynamic files, so that you  
don’t  
have to do say the Apache rule of “does this file exist on disk, if so,  
it’s  
static, and serve that, if not, go to Mongrel.” But, in my experience,  
I’ve  
found Pound to be very easy to configure and use, and had good  
performance.

I think Nginx is definitely worth a look, but if you require known  
support  
and things like that, then that will likely rule it out. I don’t have  
enough experience with it to say how solid it is, I’ve mainly done  
benchmarking against it (with good results there).

On 4/12/07, goodieboy [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> needs to be as light weight as possible and almost invisible to the
> 
> >

–  
Chris B.  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 7:20pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/6 "2007-04-12T19:20:48Z")

</div>

I’m in a similar situation. I’ve used both an apache-\>pen-\>mongrel  
approach with a side of thttpd and, apache-\>nginx-\>mongrel. I’ve only  
started using nginx in the last couple of weeks but, since I compiled it  
in user space the system admins didn’t even know it was there until I  
told them today. brainspl.at has a great config example that takes into  
account rails page caching and Capistrano maintenance commands.

–R

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 5:51pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/7 "2007-04-12T17:51:34Z")

</div>

goodieboy wrote:

> NGINX site that it leaks 20MB/hour? Yikes. Can’t have that.
> 
> Should we just let Mongrel serve static content and use Pound or  
> Balance?
> 
> Thanks for any help or recommendations. What I’d love to see (wishful  
> thinking) is a list of pros and cons of each valid setup.

Hi Matt,

Here is a way to combine Apache 2.0 with nginx

Put something like this in your virtual host replacing 3000 with the  
port number that nginx is going to use. The line “ProxyPass /errors !”  
prevents apache from requesting files from /errors from nginx instead of  
serving them itself. Which is really useful if you want to have custom  
error messages, and don’t want apache to say something like “error 503  
bad gateway, additionally a 503 error was encountered trying to retrieve  
the error document” when nginx isn’t running. You can use similar  
syntax to have apache serve any content rather than ask nginx for it.  
so you could drop a php webapp in /php, and then “ProxyPass /php !”.

```
 ProxyPass /errors !
 ProxyPass / http://127.0.0.1:3000/
 ProxyPassReverse / http://127.0.0.1:3000/
 ProxyPreserveHost on

```

Here is a link to one of our docs on nginx.

[http://docs.planetargon.com/Nginx\_Configuration](http://docs.planetargon.com/Nginx_Configuration)

–  
Daniel J.  
Systems Administrator

PLANET ARGON, LLC  
Ruby on Rails Development, Consulting & Hosting

> **[Planet Argon](https://www.planetargon.com)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://teknot.us](http://teknot.us) [blog]  
teknotus [freenode IRC]  
+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 7:36pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/8 "2007-04-12T19:36:50Z")

</div>

On Apr 12, 2007, at 6:56 AM, goodieboy wrote:

> I’m messing with LightTPD, seems to be working but I just read on the  
> rest of the server in terms of strain.  
> Just use nginx and mongrel cluster. It meets your requirements  
> better then any of the other mentioned options. I am running close to  
> 300 instances of nginx in front of mongrel clusters and nginx has  
> been rock solid, uses basically no resources even under heavy load  
> and is basically the one part of my stack that I’ve _never_ had a  
> problem with.

Nginx is rock solid and IMHO the absol;ute best front end for  
mongrel cluster available today. Using pound or anythign esle in  
between apache and mongrel is just adding complexity for no benefits.

Just use nginx, you won’t regret it.

Cheers-

– Ezra Z.  
– Lead Rails Evangelist  
– removed\_email\_address@domain.invalid  
– Engine Y., Serious Rails Hosting  
– (866) 518-YARD (9273)

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 12, 2007, 8:39pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/9 "2007-04-12T20:39:57Z")

</div>

Or try HAProxy/Perbal -\> Lighty and Mongrel cluster. After playing  
around with many deployment options, I find this to be the best for  
me. If you use HAProxy, you can work around the rails single threaded  
issue. Perbal can serve static files really fast.

Vish

---

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 13, 2007, 9:07pm UTC](https://www.ruby-forum.com/t/completely-confused-and-overwhelmed/91811/10 "2007-04-13T21:07:12Z")

</div>

OK thank you everyone for your help!

I decided to give nginx a try and it’s working very well so far!

I have some more questions but am going to create a new thread!

-matt
