Apache 或 lighttpd

发布于 2024-07-06 21:46:36 字数 1451 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

聽兲甴掵 2024-07-13 21:46:36

两者的好处是:Apache 更强大且可扩展(如果您不需要这种功能则无用,但无论如何......)并且lighttpd 在静态内容方面更快。 这个想法是将您的站点分为静态内容(css、js、图像等)和流经 Apache 的动态代码。

我并不是说你不能单独使用 lighttpd 做很多事情。 你可以,人们也可以。

如果您仅在生产服务器上使用 lighttpd,我会认真考虑将其镜像到您的开发和登台服务器上,以便您在部署之前确切地知道会发生什么。

The benefit of both: Apache is more powerful and extensible (useless if you don't need that power, but anyway...) and lighttpd is faster at static content. The idea is of splitting your site into static content (css, js, images, etc) and dynamic code that flows through Apache.

I'm not saying you can't do a lot with lighttpd on its own. You can and people do.

If you're using lighttpd exclusively on your production server, I would seriously consider mirroring that on your development and staging servers so you know exactly what to expect before you deploy.

迷荒 2024-07-13 21:46:36

对于具有来自不同 IP 地址的 n 个 http 请求的纯静态网页(.gif、.css 等):
1. Apache:运行n个进程(内存中有mod_perl、mod_php)
2. lighttpd:运行 1 个进程和 1 个线程(您可以在启动之前分配 m 个线程)

对于具有来自不同 IP 地址的 n 个 http 请求的纯动态网页(.php、.pl):
1. Apache:运行n个进程(内存中有mod_perl、mod_php)
2. lighttpd:通过异步 I/O 运行 1 个 lighttpd 进程,并为每种脚本语言运行 m 个 fast-cgi 进程。

Lighttpd 消耗的内存要少得多。 YouTube 曾经是lighttpd 的大用户,直到被Google 收购。 请访问其主页了解更多信息。

PS 在我之前的公司,我们使用负载均衡器来根据 url 后缀分配 http 流量。 为什么不完全lighttpd? 由于遗留原因。

For purely static web pages (.gif, .css, etc.) with n http requests from distinct ip addresses:
1. Apache: Runs n processes (with mod_perl, mod_php in memory)
2. lighttpd: Runs 1 process and 1 threads (You can assign m threads before launching it)

For purely dynamic web pages (.php, .pl) with n http requests from distinct ip addresses:
1. Apache: Runs n processes (with mod_perl, mod_php in memory)
2. lighttpd: Runs 1 lighttpd process thanks to async I/O, and runs m fast-cgi processes for each script language.

Lighttpd consumes much less memory. YouTube used to be a big user of lighttpd until it was acquired by Google. Go to its homepage for more info.

P.S. At my previous company, we used both with a load balancer to distribute the http traffic according to its url suffixes. Why not fully lighttpd? For legacy reasons.

苍暮颜 2024-07-13 21:46:36

Web 服务器和 Django 之间的交互方式可能比 Web 服务器软件的选择对性能产生更大的影响。 例如,众所周知,mod_python 对 RAM 的占用很大。

这个问题及其答案也讨论了其他 Web 服务器选项。

我不会担心客户端软件的兼容性问题(请参阅 MarkR 的评论)。 我在使用 lighttpd 和 FastCGI 服务 Django 时没有遇到过这样的问题。 我希望看到服务器和客户端软件的多样化生态系统。 拥有良好的标准比单一供应商的事实上的产品更好。

The way you interface between the web server and Django might have even a greater impact on performance than the choice of web server software. For instance, mod_python is known to be heavy on RAM.

This question and its answers discuss other web server options as well.

I wouldn't be concerned on compatibility issues with client software (see MarkR's comment). I've had no such problems when serving Django using lighttpd and FastCGI. I'd like to see a diverse ecosystem of both server and client software. Having a good standard is better than a de facto product from a single vendor.

天涯离梦残月幽梦 2024-07-13 21:46:36

答案取决于您的项目目标。 如果它是一个大型站点,正常运行时间至关重要且负载很高,请选择 lighttpd; 它的规模惊人。 唯一的缺点是一开始你必须更多地亲自动手。 大多数主机不支持这一点,了解您正在使用 lighttpd 做什么确实值得。

如果这是您母亲的网站,每月将有几千名访问者,那么 apache 会工作得更好。 她将能够更轻松地搬到新的主人,并且更容易找到支持。

The answer depends on your projects goals. If it's going to be a large scale site where uptime is critical and load is hight go with lighttpd; it scales amazingly. The only downside is that you have to be more hands on initially. Most hosts won't support this and it really pays to know what you're doing with lighttpd.

If it's a site for your mother that'll get a few thousand visitors a month apache'll work better. She'll be able to move to a new host a lot easier and support is easier to find.

金橙橙 2024-07-13 21:46:36

使用标准网络服务器。 50% 的网站使用 Apache (Netcraft)因此,如果您使用 Apache,人们的网络浏览器、蜘蛛、代理等几乎可以保证与您的网站(无论如何其网络服务器)一起工作。

1.5% 的网站使用 Lighthttpd (Netcraft) ,因此人们用它来测试他们的应用程序的可能性要小得多。

任何性能差异在生产中可能并不重要; Apache 服务器可能可以在生产中部署的最慢的硬件上以比您高得多的带宽来服务静态请求。

Use a standard web server. Apache is used by 50% of web sites (Netcraft), therefore, if you use Apache, peoples' web browsers, spiders, proxies etc, are pretty much guaranteed to work with your site (its web server anyway).

Lighthttpd is used by 1.5% of web sites (Netcraft), so it's far less likely that people will test their apps with it.

Any performance difference is likely not to matter in production; an Apache server can probably serve static requests at a much higher bandwidth than you have, on the slowest hardware you're likely to deploy in production.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文