Apache 可以处理多少连接/多少带宽?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1276439/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How many connections/how much bandwidth can Apache handle?
提问by Sam Lee
This is a request for pointers to good documentation/good articles. I'm looking for information on how many connections an Apache server can reasonably handle, and potentially how to load balance between multiple servers. I've done Google searches but it's harder for beginners to judge what are good docs.
这是对好的文档/好的文章的指针的请求。我正在寻找有关 Apache 服务器可以合理处理多少连接以及可能如何在多个服务器之间进行负载平衡的信息。我已经进行了谷歌搜索,但初学者很难判断什么是好的文档。
回答by skaffman
Apache 1.3 had some nasty scalability limitations, but later versions are designed to scale with the hardware and operating system, making them the bottleneck rather than the web server itself. As always, though, it comes down to how you configure and tune it if you want uber performance. Each situation has its own demands, and they're documented here:
Apache 1.3 有一些严重的可扩展性限制,但后来的版本被设计为随硬件和操作系统扩展,使它们成为瓶颈,而不是 Web 服务器本身。但是,与往常一样,如果您想要超级性能,这取决于您如何配置和调整它。每种情况都有自己的要求,它们记录在此处:
http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
http://httpd.apache.org/docs/2.2/misc/perf-tuning.html
The above assumes you're serving static content, which is where Apache excels. If you run webapps behind it, that's your bottleneck, not Apache.
以上假设您正在提供静态内容,而这正是 Apache 的优势所在。如果你在它后面运行 webapps,那就是你的瓶颈,而不是 Apache。
回答by MarkR
Unfortunately you'll be disappointed.
不幸的是,你会失望的。
Apache's ability to handle connections (and indeed any other web server's) is limited by what the web application sitting on top of it is doing. If you're serving static pages, you will be able to serve a lot of requests with very little hardware.
Apache 处理连接(以及任何其他 Web 服务器的)的能力受到位于它之上的 Web 应用程序正在执行的操作的限制。如果您正在处理静态页面,您将能够用很少的硬件处理大量请求。
Depending on the IO workload (Apache cannot work faster than the IO subsystem - install enough ram to cache your entire content, if you can), you will be able to fill up a gigabit network on any reasonable spec modern box.
根据 IO 工作负载(Apache 不能比 IO 子系统更快地工作 - 如果可以,安装足够的内存来缓存您的整个内容),您将能够在任何合理规格的现代机器上填满千兆网络。
Once you've filled a gigabit network, you'll have other things to worry about.
一旦你填满了一个千兆网络,你就会有其他事情需要担心。
But the reasons that you really need load balancers are because your application slows down Apache and uses up the box's resources. Your application will not be infinitely fast, nor infinitely scalable. You'll need to address those issues.
但是您真正需要负载平衡器的原因是您的应用程序会减慢 Apache 的速度并耗尽机器的资源。您的应用程序不会无限快,也不会无限扩展。你需要解决这些问题。
回答by jkupferman
As the previous answers have pointed out it is generally not the case that Apache becomes the bottleneck, instead it is usually the application server (PHP, Mongrel, etc). However, if you are only serving static content then you will want to do some benchmarking to see how fast it can go. Of course it is unlikely to peg the exact number which Apache will be able to serve since a lot depends on how you configure it (e.g. disabling persistent connections) and the specs of the server. However to get a ballpark estimate you can use this benchmarkas a reference since it is run on 1-8 cores (using one or two servers) so you should be able to find something reasonably comparable to the hardware you are considering.
正如前面的答案所指出的那样,Apache 通常不会成为瓶颈,而通常是应用程序服务器(PHP、Mongrel 等)。但是,如果您只提供静态内容,那么您将需要进行一些基准测试以查看它的运行速度。当然,不太可能确定 Apache 能够提供的确切数量,因为在很大程度上取决于您如何配置它(例如禁用持久连接)和服务器的规格。但是,要获得大致的估计,您可以使用此基准测试作为参考,因为它运行在 1-8 个内核(使用一台或两台服务器)上,因此您应该能够找到与您正在考虑的硬件相当的东西。
Of course in order to get the most accurate results you will want to test it yourself using a load generator like abor httperf.
当然,为了获得最准确的结果,您需要使用负载生成器(如ab或httperf )自行测试。

