多个组件部署到同一应用程序服务器
虽然我主要对 Java/GlassFish 感兴趣,但我当然认为它适用于任何平台/应用程序服务器。
出于扩展的目的,是否可以将同一 JAR、WAR 或 EAR 的多个实例部署到同一 GlassFish 服务器?这意味着,如果我有 MyApp.ear
,并且看起来我需要对其进行扩展以应对负载峰值,我可以重新部署 2 个以上的 MyApp.ear
实例吗? code> 在同一个 GlassFish 服务器内?
这样做实用吗?
Although I'm primarily interested in Java/GlassFish with this question, I would certainly think it applies to any platform/app server.
Is it possible to deploy multiple instances of the same JAR, WAR or EAR to the same GlassFish server, for the purposes of scaling? Meaning, if I have MyApp.ear
, and it looks like I need to scale it up to handle a spike in load, can I re-deploy 2+ instances of MyApp.ear
inside the same GlassFish server?
Is it practical to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这很大程度上取决于您的应用程序。一般来说,任何模块的多个实例都不是问题,如果:
- 他们不使用相同的战争背景并且
- 不要对 EJB 等使用相同的 JNDI 名称。
问题是,你为什么要这样做。通常,您有两种选择来扩展 Java EE 应用程序和服务器。水平和垂直。
水平是指在许多(较小的)计算机上拥有多个应用程序服务器实例。垂直意味着同一台(更大)机器上的多个应用程序服务器实例。如果您研究 Java EE 扩展和集群,答案是:您不会“扩展”(多重部署)您的应用程序,但您将扩展您的应用程序服务器实例。
这里有一篇关于 GlassFish 集群的很好的介绍文章:
http://glassfish.java.net/public/clustering31.html
包括对拓扑和架构的详细了解。
我看到人们尝试将同一个应用程序部署到一个应用程序服务器两次或多次的唯一原因是他们正在考虑同时运行不同的版本。 GlassFish 有一个称为“应用程序版本控制”的功能。观看此处的截屏:http://www.youtube.com/watch?v =lgbr_Hywawc
但即使此功能也不允许您并行运行它们,但您可以将不同的版本部署到您的实例。
谢谢,
中号
this highly depends on your application. In general it's not an issue to have multiple instances of any module, if:
- They don't use the same war context and
- Don't use same JNDI names for e.g. EJBs.
The question is, why would you do this. Typically you have two options for scaling Java EE applications and servers. Horizontal and vertical.
Horizontal refers to having multiple app-server instances on many (smaller) machines. Vertical means multiple app-server instances on the same (bigger) machine. If you look into Java EE scaling and clustering the answer is: You are not going to "scale" (multi-deploy) your app but you are going to scale your app-server instances.
There is a good introduction article about clustering with GlassFish here:
http://glassfish.java.net/public/clustering31.html
Including a detailed look at topology and architecture.
The only reason I have seen people trying to deploy the same app twice or more to one app-server is that they are looking into having different versions running at the same time. There is a GlassFish feature called "Application Versioning". Have a look at the screen-cast here: http://www.youtube.com/watch?v=lgbr_Hywawc
But even this feature wouldn't allow you to run them in parallel, but you could have different version deployed to your instances.
Thanks,
M
至少在 JBoss 上绝对是可能的,所以我想在 GlassFish 上也可以。然而我想知道,这对扩展有何帮助?如果您在单个服务器上缺乏性能,您可能只想考虑配置 GlassFish。您或许可以调整 JVM 设置来处理峰值负载。
我认为要扩展 java 应用程序,您应该在不同的服务器上运行它。您可以对整个应用程序或其中的一部分执行此操作。 (例如,如果您有一个层架构,您可以让您的层在不同的服务器上运行,这将需要一些或大量的重构)
It is definately possible on JBoss atleast so I suppose it also on GlassFish. I wonder however, how would this help with scaling? If you lack performance on a single server, you might want to just look into configuring GlassFish. You can probably tweak the JVM settings to handle the spike loads.
I think to scale a java application you should run it on different servers. You could do this for your entire application or a part of it. (for example if you have a n tier architecture you could have your tiers running on different servers, this will require some or alot of refactoring)
我对企业架构了解不多,但我认为在同一个JVM中运行两个实例是可能的。但它的扩展性不好。您可能需要考虑分布式架构。
I don't know much about enterprise architecture, but I think it's possible to run two instances in the same JVM. It doesn't scale well though. You might want to consider a distributed architecture.