您如何比较 Apache Tomcat 和 Glassfish 作为生产服务器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/327793/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 16:58:54  来源:igfitidea点击:

How would you compare Apache Tomcat & Glassfish as production servers?

apachedeploymentglassfishwebserver

提问by Satya

I have a J2EE-based system which is running currently on Apache Tomcat. We are in discussions to move our production servers to the Glassfish server.

我有一个基于 J2EE 的系统,它当前在 Apache Tomcat 上运行。我们正在讨论将我们的生产服务器迁移到 Glassfish 服务器。

Can someone share their experiences with either of them?

有人可以与他们中的任何一个分享他们的经验吗?

采纳答案by Oli

Here's quite an old comparison. As such, the capabilities of each server have doubtless improved.

这是一个相当古老的比较。因此,每个服务器的功能无疑都得到了改进。

Edit: Here is a current comparison.

编辑:这是当前的比较。

Both are more than stable enough for production use though. It's really going to come down to features.

不过,两者对于生产使用来说都足够稳定。这真的会归结为功能。

回答by Johannes Schaub - litb

They are not really comparable.

他们真的没有可比性。

Apache Tomcat is not a J2EE Server. It's merely a Servlet Container for Web-Applications. Nothing more. If you need J2EE API implementations, you have to take those from elsewhere. For example by using the Apache Geronimo Server which uses Tomcat as its container, or by taking the JAR files from Glassfish.

Apache Tomcat 不是 J2EE 服务器。它只是一个用于 Web 应用程序的 Servlet 容器。而已。如果您需要 J2EE API 实现,则必须从别处获取它们。例如,通过使用使用 Tomcat 作为其容器的 Apache Geronimo 服务器,或者通过从 Glassfish 获取 JAR 文件。

Glassfish is a complete Java Application Server with implementation for APIs like JPA, EJBs and more. Glassfish contains a Servlet Engine initially used by Tomcat, but they improved it (don't know what exactly). More recent glassfish servers use another container using grizzlywhich uses the NIO API for input/output and scales quite well. As far as i know, the Glassfish Servlet Engine is more performant. Here i've found a nice benchmark (it's a bit old though):

Glassfish 是一个完整的 Java 应用服务器,实现了诸如 JPA、EJB 等 API。Glassfish 包含一个最初由 Tomcat 使用的 Servlet Engine,但他们对其进行了改进(不知道具体是什么)。最近的 glassfish 服务器使用另一个容器grizzly,该容器使用NIO API 进行输入/输出并且扩展性很好。据我所知,Glassfish Servlet Engine 的性能更高。在这里,我找到了一个不错的基准测试(虽然它有点旧):

http://weblogs.java.net/blog/sdo/archive/2007/05/how_to_test_con.html

http://weblogs.java.net/blog/sdo/archive/2007/05/how_to_test_con.html

回答by StaxMan

Big question is: why? What do you think you need that Glassfish will provide you over Tomcat or Jetty? Management utilities perhaps?

大问题是:为什么?您认为 Glassfish 将通过 Tomcat 或 Jetty 为您提供什么?也许是管理实用程序?

Most things you want beyond basic servlet container are easily pluggable.

除了基本的 servlet 容器之外,您想要的大多数东西都可以轻松插入。

So while Glassfish is fine as is, there is no point in moving "just because". Most production services I have built are on plain old servlet containers, using none of implementation-specific features.

因此,虽然 Glassfish 原样很好,但“仅仅因为”而移动是没有意义的。我构建的大多数生产服务都在普通的旧 servlet 容器上,不使用任何特定于实现的功能。

回答by Philip Templeton

This may be a little dated and maybe even a little biased, but it's from Oracle. You can skip down to the section for comparing Glass Fish to Tom Cat

这可能有点过时,甚至可能有点偏颇,但它来自 Oracle。您可以跳到将 Glass Fish 与 Tom Cat 进行比较的部分

http://java.sun.com/developer/technicalArticles/glassfish/GFandMySQL_Part1.html

http://java.sun.com/developer/technicalArticles/glassfish/GFandMySQL_Part1.html