为什么使用 Apache 而不是 NGINX/Cherokee/Lighttpd?
十多年来,Apache 一直是事实上的标准 Web 服务器,但近年来,我们的 Web 服务器消耗更少的 RAM,并使用更少的线程和异步 I/O 每秒处理更多的请求。在我看来,我还发现这些服务器的配置更加简单和最少。
当异步服务器如此轻量级时,为什么人们还使用 Apache?有什么明显的好处吗?
Apache has been the de facto standard web server for over a decade, but recent years have brought us web servers that consume less RAM and handle many more requests per second using fewer threads and asynchronous i/o. In my opinion, I also find the configuration of these servers to be more straightforward and minimal.
Why do people use Apache when asynchronous servers are so much more lightweight? Is there any clear benefit?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无处不在、“足够好”和熟悉。
Ubiquity, "good enough", and familiarity.
Apache 的 .htaccess 提供灵活的配置。这允许共享主机上的用户自定义 apache 的某些设置,而无需更改核心 apache 配置。
它是典型 LAMP 设置中捆绑的标准服务器,尽管许多服务结合使用其他 Web 服务器(如静态文件、视频流等)。
由于 Apache 很流行,因此很容易找到任何问题的解决方案。
除此之外,其他解决方案可能会更好。
Apache's .htaccess provides flexible configuration. This allows users on a shared host to customize certain settings of an apache without having to alter the core apache configs.
It is the standard server bundled in typical LAMP setups, although, many services use other web servers for in conjunction (like static files, video streaming, etc.).
Since Apache is popular, it's easy to find a solution to any problems.
Other than that, other solutions would probably be better.
如果您希望 Apache 与事件 MPM 一起使用,那么它是异步的。与 Nginx 和 Cherokee 等不同,它不是默认的。
Apache 在 2.4 中采取了一些重要举措,因此它可以更具竞争力 - 尤其是。因为它涉及使用事件 MPM 提供静态请求。各种基准测试并没有很好地说明这一点,但是:
很难确定 Apache 在 2.4 中慢了多少,因为 Apache 的开箱即用配置对性能有害,而遗留的配置在某些方面阻碍了它的发展。例如,.htaccess 需要在每个请求上统计/读取多个文件,其中可能包括许多规则和正则表达式。 Nginx 没有这个问题,Cherokee 也没有。 Litespeed 具有 Apache 风格的 .htaccess 支持,但前提是您付费。大多数基准测试不会关闭此类功能。
大多数基准测试也很荒谬,因为它们是在本地运行并通过 GbE 网络或类似网络运行的。真正的网络服务器必须能够很好地应对各种速度,包括 3G 手机。 Apache 在现实世界中的性能可能更好。
我对此表示怀疑。
Nginx 还是更快,我可能会选择它,但 Apache 并没有睡着。
Apache IS asynchronous if you want it to be with the Event MPM. Unlike Nginx and Cherokee, etc., it is not the default.
Apache's made some important moves in 2.4 so it can be more competitive — esp. as it pertains to serving static requests using the Event MPM. Various benchmarks don't speak well of this, but:
It's very difficult to ascertain how much slower Apache is in 2.4 because Apache's out of the 'box' configuration is detrimental to performance and legacy holds it back in some respects. For example, .htaccess requires stat/reading a multitude of files on every request, which may include many rules and regexes. Nginx doesn't have this problem, nor does Cherokee. Litespeed has .htaccess support in Apache's style, but only if you pay for it. Most benchmarks don't turn off features like those.
Most of the benchmarks are also ridiculous in that they're run locally and over a GbE network or similar. A real web server has to cope well with various speeds, including 3G phones. It could be that Apache's performance is better in the real world.
I doubt it.
Nginx is still faster, and I might choose it, but Apache isn't asleep.