将 Lighttpd 置于 Apache 之前的另一个好处
我在一个网站上读到,在 Apache 之前使用 Lighttpd 的另一个好处是子进程数量较少。 Lighttpd 将处理保持活动和客户端请求,而 Apache 的子进程可以更快地提供动态页面,因为 Lighttpd 和 Apache 之间的通信延迟非常低。我正在尝试找到链接,但我遇到了困难。
鉴于我已经有一个专用的 Lighttpd 服务器用于我的静态内容(img、vid、css、js、html 等)和另一个专用的 Apache 服务器用于我的动态页面(php),我想实现这项技术(如果它确实如此)有一些性能增益。
1) 是否有人出于与上述相同的目的在 Apache 前面放置了 Lighttpd?
2)这真的有性能提升吗?多少钱?
3) Lighttpd 处理 Apache 请求的开销怎么样,真的值得吗?
谢谢!
I have read in a site that another benefit of having Lighttpd in front of Apache is lower number of child processes. Lighttpd will handle keep-alive and client requests while child processes of Apache gets to serve dynamic pages faster because of the very low latency communication between Lighttpd and Apache. I am trying to find the link but I am having a hard time.
Given that I already have a dedicated Lighttpd server for my static contents (img, vid, css, js, html, etc.) and another dedicated Apache server for my dynamic pages (php), I would like to implement this technique if it really has some performance gain.
1) Has anybody put a Lighttpd in front of Apache for the same purpose as explained above?
2) Is there really a performance gain on this? How much?
3) What about the overhead of Lighttpd handling down the request to Apache, is it really worth it?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Lighttpd 非常适合静态 CDN,与 Apache 一起用于数据库交互脚本。
Lighttpd is great for a static CDN, coupled with Apache for the database-interactive scripts.
总的来说,我发现这种技术非常好,但是,我会使用另一个 Apache 实例来代替 lighthttpd(不必要地增加盒子上的软件数量)。
您获得的收益很大程度上与记忆有关。如果您使用非常“胖”的 Apache,例如在 prefork 中使用 mod_perl 或 PHP 或其他一些内存密集型模块,那么您必须将 MaxClients 设置得非常低,以避免耗尽 RAM。
另一方面,MaxClients 可以通过保持活动请求、SSL 握手、图像下载和其他琐碎的活动来访问,这些活动会不必要地消耗大量的内存。
前面的一个小型“瘦”服务器(可以是另一个没有 mod_perl、PHP 等的 Apache 实例)可以处理 keepalive、图像、SSL、重定向等,然后让主实例处理所有繁重的事情。
此外,您可以保护您的主实例免受滥用客户端的侵害,这些客户端发送请求非常缓慢或根本不发送请求(我在旧的损坏版本的 IE 上使用 XMLHttpRequest 从非滥用客户端看到了这一点)。
这是一个很好的方法,如果您的服务器由于有太多胖 apache 而导致内存不足,而这些 apache 花费了所有时间无所事事,那么它肯定会有所帮助。
In general I have seen this technique be very good, however, instead of lighthttpd, I'd use another Apache instance (don't increase the amount of software on the box unnecessarily).
The gain that you get is largely to do with memory. If you use an Apache which is very "fat" e.g. uses mod_perl or PHP or some other memory-intensive module in prefork, then you have to set MaxClients very low to avoid blowing the RAM up.
On the other hand, MaxClients can then be reached with keep-alive requests, SSL handshakes, image downloads and other trivial activities, which are consuming lots and lots of ram needlessly.
A small "thin" server in front (which can be another Apache instance without mod_perl, PHP etc) can handle keepalives, images, SSL, redirects etc, and then let the main instance handle all the heavy stuff.
Moreover, you protect your main instance from abusive clients who send requests very slowly or not at all (I have seen this from non-abusive clients using XMLHttpRequest on old broken versions of IE).
It's a good approach, and if your servers are running out of memory because they have too many fat apaches, which are spending all their time doing nothing, it will definitely help.