Nginx的v Apache的高流量的网站 [英] Nginx v Apache for high traffic sites

查看:140
本文介绍了Nginx的v Apache的高流量的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可否Nginx的是更合适的选择,因为对于高流量的网站的web服务器。

Would Nginx be a more suitable choice as a web server for high traffic websites.

我们将建立该网站是一个电子商务网站,如果有差别。

The site we will be building is a an ecommerce site if that makes a difference.

我从来看不管怎样技术角度的actualy'为什么'很感兴趣。即为什么会nginx的是从技术角度看这种类型的网站是更好的选择,或者相反,为什么它难道不

I am really interested in the actualy 'why' from a technical point of view either way. i.e. why would nginx be a better choice for this type of site from a technical standpoint, or the opposite, why it wouldnt

推荐答案

马丁,

在一般情况下,Nginx的是,由于其事件驱动架构高流量的网站更好。而不是在不同的线程处理每个请求,它使用非阻塞I / O,以服务每个线程的请求数量。

In general, Nginx is better for high-traffic sites due to its event-driven architecture. Rather than handling each request in a distinct thread, it uses non-blocking I/O to service many requests in each thread.

此体系结构的重要方面是减少使用的进程或线程。一个线程可以从任何地方2MB消耗超过64MB的RAM。所以当阿帕奇提供10KB的JPEG,它实际上可利用的RAM显著量。如果你有缓慢的客户端(如智能手机),其中请求可能保持一个线程忙了几秒钟,它变得更糟。

The important aspect of this architecture is the reduced use of processes or threads. A thread can consume anywhere from 2MB to over 64MB of RAM. So when Apache serves a 10KB JPEG, it may actually be using a significant amount of RAM. It becomes worse if you have slow clients (e.g. smartphones) where the request may keep a thread busy for several seconds.

很多人发现Nginx的运行在Apache的前代理是一个理想的中间地带。 nginx的谈话缓慢客户端,并且可以做到使用的RAM极少量。当请求转发到Apache,请求速度由您的本地连接的限制,而不是远程用户。这意味着网络瓶颈不会保留请求(和它的存储器,拱螺纹)活着高于所需的更长的时间。

Many people find that running Nginx as a proxy in front of Apache to be an ideal middle ground. Nginx talks to the slow clients and can do so using a very small amount of RAM. When requests are forwarded to Apache, the request speed is limited by your local connectivity, not that of the remote user. This means that the network bottleneck will not keep the request (and it's memory-hogging thread) alive for any longer than necessary.

总之你加上的Apache的广泛功能集的Nginx的低资源效益。

In short you get the low-resource benefits of Nginx coupled with the wide feature-set of Apache.

这篇关于Nginx的v Apache的高流量的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆