简体   繁体   English

Amazon EC2上的Autoscale Rails应用

[英]Autoscale Rails app on Amazon EC2

Currently we are using a classic configuration: Nginx in front of the instances with 3 mongrels on each. 当前,我们使用的是经典配置:Nginx在实例前面,每个实例上有3个mongrels。

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. 因此,我们需要使用Elastic Load Balancer + AutoScaling或以某种方式手动更新Nginx配置,然后AutoScaling启动新实例,以便nginx可以将流量路由到它们。

The problem with ELB is it can't pass the requests to a number of ports on a EC2 instance, only to one. ELB的问题在于它无法将请求传递给EC2实例上的多个端口,而只能传递给一个。 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. 我看到的唯一方法是在每个实例上使用HAproxy将请求代理到一堆杂物。

What should we do? 我们应该做什么? Manually update the Nginx config, or use ELB and HAProxy on each working instance? 手动更新Nginx配置,还是在每个工作实例上使用ELB和HAProxy? Is there a better way to autoscale a Rails app on Amazon? 有没有更好的方法可以在亚马逊上自动缩放Rails应用程序?

We use ELB + AutoScaler + LaunchConfig on Amazon Web Services to scale Rails applications. 我们在Amazon Web Services上使用ELB + AutoScaler + LaunchConfig来扩展Rails应用程序。

Our configuration is nginx + Passenger + Rails and that only needs one port on the instances running Rails. 我们的配置为nginx + Passenger + Rails,在运行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. 因此,您可以让任意大小的实例运行尽可能多的Rails进程(请求):当实例繁忙时,AutoScaler将启动,ELB将在所有实例上分配负载。 Again, it only needs one port on the instance. 同样,它只需要实例上的一个端口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM