应用服务器——使用还是不使用?
通常我们使用 WebLogic 或 JBoss 来部署我们的应用程序。 据我了解,当使用 Spring 等开源解决方案时,您可以开发应用程序并在 Jetty 等简单的 servlet 容器上运行它。 那么问题是为什么还要费心使用应用程序服务器呢?
Typically we use WebLogic or JBoss to deploy our apps. I understand that when using open source solutions like Spring you can develop your app and run it on a simple servlet container like Jetty. So the question would be why even bother with an app server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
交易、安全集成、池、高性能队列、集群。
管理界面。
除此之外...我不知道?
在大多数情况下,YAGNI。
transactions, security integration, pooling, hi-perf queuing, clusters.
administrative interfaces.
beyond that... I don't know?
In most cases, YAGNI.
没有人因为在企业环境中使用 WebLogic 或 WebSphere 而被解雇。 对于大企业和管理者来说,不仅技术方面很重要。 这些应用程序服务器提供功能齐全的管理控制台,即使没有经验的管理员也可以轻松使用。 此外,更容易找到支持服务。 使用开源组件的公司需要投资经验丰富的开发人员来设置一切并进行维护。 应用服务器广泛应用于公司(例如银行),其业务与软件无关。 对于他们来说,从单一供应商购买一切(软件许可证、安装/配置、支持服务)更有意义。
No one got fired for using WebLogic or WebSphere in an enterprise environment. For big businesses and managers not only the technological aspects are important. These application servers offer fully featured administration consoles that are easy to be used even from inexperienced administrators. Also, support services are easier to be found. A company that uses open source components needs to invest on experienced developers to set everything up and do the maintenance. Application servers are widely used within companies (banks for example) that their businesses have nothing to do with software. For them it makes greater sense to buy everything (software license, installation/configuration, support services) from a single vendor.
如果你非要问的话,那你就买不起。
说真的,成熟的应用程序服务器具有更多功能,您必须决定它们是否值得您使用,例如 Tomcat 或 Jetty。 我认为这里不适合尝试给出所有原因,但这里有一个:应用程序服务器可以更轻松地将功能和服务包装在事务中。 此处给出了更多原因。
If you've gotta ask, you can't afford it.
Seriously, full-blown application servers have more features, and you will have to decide if they are worth it to you over, say, Tomcat or Jetty. I don't think this is an appropriate place to try to give all the reasons, but here's one: application servers can make it easier to wrap functionality and services in transactions. More reasons are given here.
WebLogic 和 JBoss 的集群、故障转移和会话同步功能仍然使它们在大型数据中心中具有价值。
当然,JBoss 使用 Tomcat 作为他们的 Web 前端,所以它不是非此即彼。
我见过人们将 OpenEJB 和 ActiveMQ 添加到 Tomcat 并获得 Java EE 应用服务器的所有功能。 这条线相当模糊。
Spring DM 服务器构建在 Tomcat 之上。 看看它是否能开始从 Java EE 应用服务器人员手中夺走注意力和市场份额,将会很有趣。
我喜欢 Spring - 它是我的首选框架 - 但我可以告诉您,当知道 Java EE 是由多个应用程序服务器供应商实现的标准时,有些人会感到安慰。 如果您不使用特定于供应商的扩展,理论上您的代码可以从WebSphere 移动到WebLogic 再到JBoss,而无需进行任何更改。 一些大型IT商店就是这样。 他们回避 Spring,因为它不是标准。 这是罗德·约翰逊和他的团队的创意。 如果你决定不喜欢他们的东西,你就无处可去。
新的 Java IoC/DI 标准正在制定中。 罗德·约翰逊和鲍勃·李正在研究这个问题。 也许这会开始平息一些外界的恐惧。
The clustering, failover, and session synchronization features of WebLogic and JBoss still make them worthwhile in large data centers.
JBoss uses Tomcat as their web front end, of course, so it's not either/or.
I've seen people add OpenEJB and ActiveMQ to Tomcat and get all the features of a Java EE app server. The line is rather blurred.
Spring DM server is built on Tomcat. It'll be interesting to see whether it can start taking mind and market share away from the Java EE app server folks.
I love Spring - it's my preferred framework - but I can tell you that it comforts some folks to know that Java EE is a standard that's implemented by multiple app server vendors. If you don't use vendor-specific extensions, in theory your code can be moved from WebSphere to WebLogic to JBoss without changes. Some large IT shops like that. They shy away from Spring because it's not a standard. It's the brainchild of Rod Johnson and his team. If you decide you don't like their stuff you have nowhere else to go.
There's a new Java IoC/DI standard in the works. Rod Johnson and Bob Lee are working on it. Maybe that will start to calm some of the fear that's out there.
应用程序服务器是一种架构解决方案。 如果您打算考虑应用程序的不同可重用模块,则必须使用它。 如果您不介意您的服务应该通过 HTTP 堆栈实现,那么 EJB 必须是您的默认选项。 有了 AS,您就拥有了一个已经打包的解决方案,可以以架构方式解决良好实践。 您可以开箱即用地使用队列、主题、jms 等,这些都是 Java EE 标准。
但我认为您必须以这种架构嗡嗡方式思考您的所有应用程序才能判断 AS 决策。
An application server is an architectural solution. You have to use it if you are going to think different reusable modules of your application. If you don't mind that your services should be implemented over the HTTP stack so EJB must be your default option. With an AS you have an already packed solution for solve good practices in architectural way. You can use queues, topics, jms, etc out of the box, and those are all Java EE standards.
But I think that you have to think all your application in this architectural buzz-way to be able to judge the AS decision.
有几个原因,其中大多数可能适用也可能不适用于特定需求。
1)支持。 许多企业喜欢与开发服务器的供应商签订支持合同。 使用开源解决方案,您几乎可以“靠自己”。
2) 完整的Java EE / EJB 支持。 虽然我自己并不觉得这特别有用,但这些功能已被商业应用程序广泛使用。 如果你需要它们,真的别无选择。 如果你不需要它们,它们就是浪费。
3)良好的管理控制台。 Tomcat 有一个管理控制台,允许您添加和删除应用程序。 据我所知,目前的情况就这样了。 WebSphere 具有该功能(尽管不是很精简),但您还可以更改连接池大小、数据源、线程池大小、更改日志记录配置(非常高的粒度)以及激活内存和 JVM 分析。 大多数情况下无需重新启动应用程序服务器。 据说,集群的设置也相对容易。 tomcat 也明显缺少安装 .EAR 文件的功能,如果您要安装多个相互关联的应用程序,那么管理它们将变得非常痛苦。
您也可以(至少)在 tomcat 中执行 (3) 中的大部分操作,但不能通过管理 GUI 执行。 有些人喜欢有一个漂亮的 GUI。
Several reasons, most of which may or may not apply to a particular need.
1) Support. Many enterprises like to have a support contract with the vendor who developed the server. With an open source solution you are pretty much "on your own."
2) Full Java EE / EJB support. While I don't find this particularly useful myself, these features are widely used by commercial applications. If you need them, there's really no alternative. If you don't need them, they're a waste.
3) Good administration consoles. Tomcat has an admin console that will allow you to add and remove applications. As far as I am aware, that's about as far as it goes. WebSphere has that (though not very streamlined), but you can also alter connection pool sizes, data sources, thread pool sizes, change the logging configuration (very high granularity), and activate memory and JVM profiling. Mostly without restarting the App Server. Supposedly, clustering is relatively easy to set up as well. The ability to install a .EAR file is notably missing from tomcat as well, and if you have multiple inter-related applications to install, it becomes a real pain to manage them all.
You can do (at least) most of (3) in tomcat as well, but not through the admin GUI. Some people like to have a nice GUI.
有些人喜欢“以防万一”的 EJB 支持(Java EE 规范)
Some people like to have EJB support (Java EE specification) "just in case"