apache 从 Tomcat 提供静态内容的速度有多慢?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/654701/
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 much slower is serving static content from Tomcat?
提问by Drew
So, I have a webapp with a fair amount of JSPs, servlets, alot of which are using IceFaces. Obviously, most of this will have to stay in Tomcat.
所以,我有一个包含大量 JSP、servlet 的 web 应用程序,其中很多都在使用 IceFaces。显然,大部分内容将不得不留在 Tomcat 中。
However, I've been told that static content (HTML, Images, etc.) is slower on Tomcat than a pure webserver like Apache. My understanding is that when you're using Tomcat as a stand-alone webserver, it's using a version of Apache in the first place. I may be mistaken on this, of course.
但是,有人告诉我,Tomcat 上的静态内容(HTML、图像等)比纯网络服务器(如 Apache)慢。我的理解是,当您将 Tomcat 用作独立网络服务器时,它首先使用的是 Apache 版本。当然,我可能会误解这一点。
But what isthe penalty for serving static images or files from Tomcat? Is it worth breaking out into its own webserver for a low volume site?
但是从 Tomcat 提供静态图像或文件的惩罚是什么?对于一个低容量的网站,是否值得进入自己的网络服务器?
采纳答案by Eddie
See the Tomcat Connector FAQfor some information. For modern versions of Tomcat, the performance difference is muchsmaller than it used to be. For a low volume site, there is no reason that you cannot supply all content with Tomcat.
有关某些信息,请参阅Tomcat 连接器常见问题解答。对于现代版本的 Tomcat,性能差异比以前小得多。对于低容量站点,您没有理由不能使用 Tomcat 提供所有内容。
回答by Eddie
I agree except in two circumstances
我同意,除了两种情况
Tomcat's SSL using JSSE is noticeably slower. There are native versions that can be plugged in, but that tends to be more painful. In general the SSL is a bit less straightforward than the well-understand Apache Httpd server
Fronting with an HTTpd server gives more flexibility re virtual web hosts etc. Tomcat is not as flexible in this regard. Unsurprisingly it lacks all the options in Apache :). An obvious nice one is built in compression of static files is very easy to add in Apache. It's not hard in tomcat extra, but it's more work.
You are mistaken. Apache Httpd Server is a totally different beast and has no code shared with Tomcat.
使用 JSSE 的 Tomcat 的 SSL 明显较慢。有可以插入的本机版本,但这往往更痛苦。一般而言,SSL 不如易于理解的 Apache Httpd 服务器简单
使用 HTTpd 服务器前端为虚拟 Web 主机等提供了更大的灵活性。 Tomcat 在这方面没有那么灵活。不出所料,它缺少 Apache 中的所有选项:)。一个明显的好处是内置静态文件压缩,很容易在 Apache 中添加。在 tomcat extra 中并不难,但需要更多的工作。
你误会了。Apache Httpd Server 是一个完全不同的野兽,没有与 Tomcat 共享的代码。
If neither is an issue, than yeah use tomcat by itself
如果两者都不是问题,那么可以单独使用 tomcat

