不同Ruby on Rails生产Web服务器之间的推荐(和差异)

时间:2022-08-23 01:11:13

Very soon I plan on deploying my first Ruby on Rails application to a production environment and I've even picked a webhost with all the managed server and Capistrano goodness you'd expect from a RoR provider.

很快,我计划将我的第一个Ruby on Rails应用程序部署到一个生产环境中,我甚至选择了一个webhost,其中包含了所有托管服务器和您所期望的RoR提供者的Capistrano。

The provider allows for Mongrel, Thin, Passenger & FastCGI web servers, which seems very flexible, but I honestly don't know the differences between them. I have looked into them some, but it all gets a bit much when they start talking about features and maximum simultaneous requests - and that this data seems to vary depending on who's publishing it.

提供程序允许使用混合的、瘦的、乘客和快速cgi web服务器,这看起来非常灵活,但老实说,我不知道它们之间的区别。我已经研究过其中一些,但当他们开始讨论特性和最大同时请求时,一切就变得有点复杂了——而且这些数据似乎根据发布者的不同而有所不同。

I have looked at Passenger (on the surface) - which does seem very appealing to me - but I was under the impression that Passenger wasn't the actual webserver, and instead was more like a layer on top of Apache or nginx and managed spawned instances of the application (like a Mongrel cluster).

我看着乘客(表面上)——这看起来确实很吸引我,但是在我的印象中,乘客不实际的网络服务器,而更像是一层上的Apache或nginx和管理产生的实例应用程序(如一个杂种集群)。

Can anyone please set me straight with the differences in layman's terms so as I can choose wisely (because anyone who's seen Indiana Jones and the Last Crusade knows what happens if you choose poorly).

谁能告诉我外行术语的不同之处,这样我才能明智地选择(因为任何看过《夺宝奇兵》和《圣战奇兵》的人都知道,如果你选择不当会发生什么)。

4 个解决方案

#1


33  

Short answer

简短的回答

Go with Apache/Nginx + Passenger. Passenger is fast, reliable, easy to configure and deploy. Passenger has been adopted by a large number of big Rails applications, including Shopify.

使用Apache/Nginx +乘客。乘客速度快,可靠,易于配置和部署。乘客已经被大量的大型Rails应用程序所采用,包括Shopify。

alt text http://www.modrails.com/images/passenger_mongrel_thin_benchmark.png

alt文本http://www.modrails.com/images/passenger_mongrel_thin_benchmark.png

The long answer

长答案

Forget about CGI and FastCGI. In the beginning there were no other alternatives so the only way to run Rails was using CGI or the faster browser FastCGI. Nowadays almost nobody runs Rails under CGI. The latest Rails versions no longer provides .cgi and .fcgi runners.

忘记CGI和FastCGI吧。一开始没有其他的替代方案,所以运行Rails的唯一方法是使用CGI或更快的浏览器FastCGI。现在几乎没有人在CGI下运行Rails。最新的Rails版本不再提供.cgi和.fcgi跑步机。

Mongrel has been a largely adopted solution, the best replacement for CGI and FCGI. Many sites still use Mongrel and Mongrel cluster, however Mongrel project is almost dead and many projects already moved to other solutions (mostly Passenger). Also, a Mongrel based architecture is quite hard to configure because it needs a frontend proxy (thin, ngnix) and a backend architecture composed of multiple Mongrel instances.

Mongrel已经被广泛采用,是CGI和FCGI的最佳替代品。许多站点仍然使用Mongrel和Mongrel集群,但是Mongrel项目几乎已经死亡,许多项目已经转移到其他解决方案(主要是乘客)。此外,由于需要一个前端代理(thin, ngnix)和一个由多个Mongrel实例组成的后端体系结构,所以很难配置基于混合的体系结构。

Passenger has been gaining widespread attention since it was released. Many projects switched from Mongrel to Passenger for many reasons, including (but not limited to) easy deployment, maintainability and performance. Additionally, Passenger is now available for both Apache and Ngnix.

乘客自从被释放后一直受到广泛的关注。由于许多原因,许多项目从Mongrel转变为乘客,包括(但不限于)易于部署、可维护性和性能。此外,乘客现在可以使用Apache和Ngnix。

The simplest way to use Passenger is the Apache + Passenger configuration. One Apache installation and multiple Passenger processes.

使用Passenger的最简单的方法是Apache + Passenger配置。一个Apache安装和多个乘客进程。

If you need better performance and scalability, you can use Ngnix as a frontend proxy and forward all Rails requests to multiple backend servers, each one composed of Apache + Passenger. I'm not going into the technical details here, this solution is intended to be used by Rails projects with an high level of traffic.

如果需要更好的性能和可伸缩性,可以使用Ngnix作为前端代理,将所有Rails请求转发到多个后端服务器,每个后端服务器都由Apache + Passenger组成。我不会在这里详细介绍技术细节,这个解决方案将用于高通信量的Rails项目。

Even more complex solutions include a combination of different levels including http proxies and servers. You can have an idea of what I'm talking about reading some internal details from GitHub and Heroku.

更复杂的解决方案包括不同级别的组合,包括http代理和服务器。你可以知道我在说什么阅读GitHub和Heroku的一些内部细节。

Right now, Passenger is the best answer for most Rails projects.

现在,乘客是大多数Rails项目的最佳答案。

#2


9  

Mongrel and Thin are single ruby process servers that you would run multiple of as a cluster behind some type of proxy (like Apache or Nginx). The proxy would manage which instance of Mongrel or Thin services the requests.

Mongrel和Thin是单个ruby进程服务器,您可以在某种类型的代理(比如Apache或Nginx)后面作为集群运行多个ruby进程服务器。代理将管理请求的混合或瘦服务的哪个实例。

Passenger creates an interface between Apache or Nginx that creates an application spawning process and then forks out processes to server up incoming requests as they come in. There are a lot of configuration options for how long those processes live, how many there can be, and how many requests they will serve before they die. This is by far the most common way to scale up and handle a high traffic application, but it is not without drawbacks. This can only be done on a *nix operating system (linux, mac os x, etc). Also, these processes spin up on demand, so if no one accesses your site for a while, they processes die and the next request has the delay of it starting back up again. With Mongrel and Thin, the process is always running. Sometimes though, your processes being new and fresh can be a good thing for memory usage etc.

乘客在Apache或Nginx之间创建一个接口,该接口创建应用程序的生成过程,然后在传入请求时将进程分叉到服务器上。对于这些进程的生存时间、可能存在的数量以及它们在死之前将服务多少请求,有很多配置选项。到目前为止,这是扩展和处理高通信量应用程序的最常见方法,但它也并非没有缺点。这只能在*nix操作系统(linux、mac os x等)上完成。此外,这些进程按需向上旋转,因此如果有一段时间没有人访问您的站点,那么它们将处理死,而下一个请求将延迟重新启动。有了混合和瘦,进程总是在运行。但是,有时候,进程是新的和新鲜的,这对于内存使用是一件好事。

If it is going to be a relatively low traffic site, Mongrel or Thin provides a simple, easy to manage way to deploy the application. For higher traffic sites where you need the smart queuing and process management of something like Passenger, it is a very good solution.

如果它是一个相对较低的流量站点,那么Mongrel或Thin提供了一种简单、易于管理的方式来部署应用程序。对于需要智能排队和乘客等流程管理的高流量站点,这是一个很好的解决方案。

As for fastcgi, you probably want to use that as a last option.

对于fastcgi,您可能希望使用它作为最后的选项。

#3


1  

I use Passenger + nginx. It works really, really well.

我使用乘客+ nginx。它真的,真的很好。

#4


1  

To get some instant performance boast with passenger, I recommend using ruby enterprise edition.

为了获得一些即时的性能吹嘘与乘客,我建议使用ruby企业版。

#1


33  

Short answer

简短的回答

Go with Apache/Nginx + Passenger. Passenger is fast, reliable, easy to configure and deploy. Passenger has been adopted by a large number of big Rails applications, including Shopify.

使用Apache/Nginx +乘客。乘客速度快,可靠,易于配置和部署。乘客已经被大量的大型Rails应用程序所采用,包括Shopify。

alt text http://www.modrails.com/images/passenger_mongrel_thin_benchmark.png

alt文本http://www.modrails.com/images/passenger_mongrel_thin_benchmark.png

The long answer

长答案

Forget about CGI and FastCGI. In the beginning there were no other alternatives so the only way to run Rails was using CGI or the faster browser FastCGI. Nowadays almost nobody runs Rails under CGI. The latest Rails versions no longer provides .cgi and .fcgi runners.

忘记CGI和FastCGI吧。一开始没有其他的替代方案,所以运行Rails的唯一方法是使用CGI或更快的浏览器FastCGI。现在几乎没有人在CGI下运行Rails。最新的Rails版本不再提供.cgi和.fcgi跑步机。

Mongrel has been a largely adopted solution, the best replacement for CGI and FCGI. Many sites still use Mongrel and Mongrel cluster, however Mongrel project is almost dead and many projects already moved to other solutions (mostly Passenger). Also, a Mongrel based architecture is quite hard to configure because it needs a frontend proxy (thin, ngnix) and a backend architecture composed of multiple Mongrel instances.

Mongrel已经被广泛采用,是CGI和FCGI的最佳替代品。许多站点仍然使用Mongrel和Mongrel集群,但是Mongrel项目几乎已经死亡,许多项目已经转移到其他解决方案(主要是乘客)。此外,由于需要一个前端代理(thin, ngnix)和一个由多个Mongrel实例组成的后端体系结构,所以很难配置基于混合的体系结构。

Passenger has been gaining widespread attention since it was released. Many projects switched from Mongrel to Passenger for many reasons, including (but not limited to) easy deployment, maintainability and performance. Additionally, Passenger is now available for both Apache and Ngnix.

乘客自从被释放后一直受到广泛的关注。由于许多原因,许多项目从Mongrel转变为乘客,包括(但不限于)易于部署、可维护性和性能。此外,乘客现在可以使用Apache和Ngnix。

The simplest way to use Passenger is the Apache + Passenger configuration. One Apache installation and multiple Passenger processes.

使用Passenger的最简单的方法是Apache + Passenger配置。一个Apache安装和多个乘客进程。

If you need better performance and scalability, you can use Ngnix as a frontend proxy and forward all Rails requests to multiple backend servers, each one composed of Apache + Passenger. I'm not going into the technical details here, this solution is intended to be used by Rails projects with an high level of traffic.

如果需要更好的性能和可伸缩性,可以使用Ngnix作为前端代理,将所有Rails请求转发到多个后端服务器,每个后端服务器都由Apache + Passenger组成。我不会在这里详细介绍技术细节,这个解决方案将用于高通信量的Rails项目。

Even more complex solutions include a combination of different levels including http proxies and servers. You can have an idea of what I'm talking about reading some internal details from GitHub and Heroku.

更复杂的解决方案包括不同级别的组合,包括http代理和服务器。你可以知道我在说什么阅读GitHub和Heroku的一些内部细节。

Right now, Passenger is the best answer for most Rails projects.

现在,乘客是大多数Rails项目的最佳答案。

#2


9  

Mongrel and Thin are single ruby process servers that you would run multiple of as a cluster behind some type of proxy (like Apache or Nginx). The proxy would manage which instance of Mongrel or Thin services the requests.

Mongrel和Thin是单个ruby进程服务器,您可以在某种类型的代理(比如Apache或Nginx)后面作为集群运行多个ruby进程服务器。代理将管理请求的混合或瘦服务的哪个实例。

Passenger creates an interface between Apache or Nginx that creates an application spawning process and then forks out processes to server up incoming requests as they come in. There are a lot of configuration options for how long those processes live, how many there can be, and how many requests they will serve before they die. This is by far the most common way to scale up and handle a high traffic application, but it is not without drawbacks. This can only be done on a *nix operating system (linux, mac os x, etc). Also, these processes spin up on demand, so if no one accesses your site for a while, they processes die and the next request has the delay of it starting back up again. With Mongrel and Thin, the process is always running. Sometimes though, your processes being new and fresh can be a good thing for memory usage etc.

乘客在Apache或Nginx之间创建一个接口,该接口创建应用程序的生成过程,然后在传入请求时将进程分叉到服务器上。对于这些进程的生存时间、可能存在的数量以及它们在死之前将服务多少请求,有很多配置选项。到目前为止,这是扩展和处理高通信量应用程序的最常见方法,但它也并非没有缺点。这只能在*nix操作系统(linux、mac os x等)上完成。此外,这些进程按需向上旋转,因此如果有一段时间没有人访问您的站点,那么它们将处理死,而下一个请求将延迟重新启动。有了混合和瘦,进程总是在运行。但是,有时候,进程是新的和新鲜的,这对于内存使用是一件好事。

If it is going to be a relatively low traffic site, Mongrel or Thin provides a simple, easy to manage way to deploy the application. For higher traffic sites where you need the smart queuing and process management of something like Passenger, it is a very good solution.

如果它是一个相对较低的流量站点,那么Mongrel或Thin提供了一种简单、易于管理的方式来部署应用程序。对于需要智能排队和乘客等流程管理的高流量站点,这是一个很好的解决方案。

As for fastcgi, you probably want to use that as a last option.

对于fastcgi,您可能希望使用它作为最后的选项。

#3


1  

I use Passenger + nginx. It works really, really well.

我使用乘客+ nginx。它真的,真的很好。

#4


1  

To get some instant performance boast with passenger, I recommend using ruby enterprise edition.

为了获得一些即时的性能吹嘘与乘客,我建议使用ruby企业版。