1
votes

Currently we are using a classic configuration: Nginx in front of the instances with 3 mongrels on each.

We want to autoscale our app.

So, we need to use either Elastic Load Balancer + AutoScaling or somehow manually update our Nginx config, then AutoScaling launches new instances, so nginx can route traffic to them.

The problem with ELB is it can't pass the requests to a number of ports on a EC2 instance, only to one. So, we can't run a bunch of mongrels on our instances to gain more performance from a single instance. The only way I see is to use HAproxy on each instance to proxy requests to a bunch of mongrels.

What should we do? Manually update the Nginx config, or use ELB and HAProxy on each working instance? Is there a better way to autoscale a Rails app on Amazon?

1

1 Answers

0
votes

We use ELB + AutoScaler + LaunchConfig on Amazon Web Services to scale Rails applications.

Our configuration is nginx + Passenger + Rails and that only needs one port on the instances running Rails. So you can have any size instance you want running as many Rails processes (requests) as it can handle: when the instance gets busy, the AutoScaler will kick in and the ELB will distribute load across all of them. Again, it only needs one port on the instance.