GlassFish 应用服务器中的多实例应用程序架构和部署

发布于 2025-01-02 10:13:58 字数 1327 浏览 3 评论 0原文

我需要为每台 GlassFish 服务器 (v 3.1) 的大约 100 个客户设置一个托管环境。 每个客户都需要自定义配置的应用程序,这些应用程序可以彼此独立运行。 (JDBC、JMS、重启单个应用程序的可能性) 首选运行单个虚拟机,因为启动 100 个 JVM,每个 JVM 使用 750MB RAM 听起来并不是一个好主意。

到目前为止,我已经测试了以下解决方案,但不幸的是,这些解决方案都没有满足我的要求:

  1. 在单独的域上部署应用程序。由于 JVM Ram 的使用以及在多个端口上运行多个管理控制台的复杂性(我们不需要那么多的分离),该解决方案是不够的。

  2. 在同一域的多个实例(Glassfish 上的命名目标)上部署应用程序。该解决方案是不够的,因为它为每个实例创建单独的 JVM 进程并消耗太多 RAM(每个实例数百 MB)。否则它最接近我们的需要。

  3. 在同一实例的多个虚拟主机上部署应用程序。该解决方案是不可接受的,因为在 Glassfish 中,每个虚拟服务器没有单独的配置。

谁能建议使用 GlassFish 托管多个应用程序实例的最佳实践/建议是什么?我们“注定”要为每个客户保留 1GB 的 RAM 吗?来自 IIS 环境,我们有单独的应用程序池,每个应用程序池在启动时使用 3-5MB 的 RAM。


更新

关于我的应用程序中的依赖和共享: 在我想在 Glassfisf 服务器上实现的想法中,每个应用程序都需要单独的资源(JMS 和 JDBC)。这不是问题,我可以根据应用程序甚至在一个实例上启用的每个虚拟主机对其进行自定义(我可以通过从 Http 请求获取服务器名称来识别虚拟服务器,并在实例目录中准备单独的资源和配置文件,以将配置应用于此特定虚拟服务器)。

我的“独立性要求”是:

  1. 我只需要能够在一个 Glassfish 实例上部署多个应用程序,并能够在单独的 Java 进程中但在同一个 Java 虚拟机下运行它们。
  2. 我需要能够独立地启动/停止每个应用程序。
  3. 我需要能够重新加载一个应用程序和另一个应用程序,同时其他应用程序应保持活动状态(在 IIS 下,此选项称为“回收应用程序池”)。
  4. 如果一个应用程序出现错误,它不应影响同一服务器/实例上的其他客户应用程序。其他应用程序应该保持工作(当然,当这个错误不会破坏整个 java 虚拟机时)。

这一想法是否可以在部署了数百个应用程序(在实例/虚拟主机上启用)的一个 Glassfish 实例上实现?也许在我的情况下,以不同的名称部署应用程序(如此处所述:home.java.net/node/676678)可能是一个很好的解决方案?有人有过以不同的配置部署一百次相同应用程序的经验吗?

谢谢,

奥尔吉尔德

I need to setup a hosting environment for around 100 customers per one GlassFish server (v 3.1).
Each customer needs custom configured application that can be run independently from each other. (JDBC, JMS, possibility to restart single app)
Running single virtual machine would be preferred, as launching 100 JVMs each using 750MB of RAM doesn’t sound like a good idea.

So far I have tested the following solutions, but unfortunately, neither of these has met my requirements:

  1. Deploying application on separate Domains. This solution was insufficient because of JVM Ram usage and complexity of running multiple management consoles on multiple ports (we don’t need that much separation)

  2. Deploying application on multiple instances (named targets on Glassfish) on the same domain. This solution was insufficient because it creates separate JVM process for each instance and consumes too much RAM (several hundred MB for each instance). Otherwise it was closest to what we need.

  3. Deploying application on multiple virtual hosts on the same instance. This solution was unacceptable because in Glassfish each virtual server doesn't have a separate configuration.

Can anyone suggest what is the best practice / recommendation for using GlassFish to host multiple application instances? Are we “doomed” to reserve 1GB of ram per customer? Coming from IIS environment, we had separate Application Pools each using 3-5MB of RAM at startup.


UPDATE

About my dependency and sharing in my app:
In the idea I want to realize on Glassfisf server, each application needs separate resources (JMS and JDBC). This is not a problem, I can customize it per application even per virtual hosts enabled on one instance (I can recognize the virtual server by getting server name from Http Request and prepare separate resources and configuration files in instance directory to apply configuration to this specific virtual server).

My 'independency requrements' are:

  1. I simply need to be able to deploy multiple applications on one Glassfish instance and be able to run them in separate Java processes but under the same Java virtual machine.
  2. I need to be able to start/stop each application independently from each other.
  3. I need to be able reload one application and the other while the othe applications should remain active (under IIS this option is called 'recycle application pool').
  4. In case of a bug in one application, it should not impact on other customer apps on the same server/instance. Other applications shoud remain working (of course when this bug doesn't spoil entire java vm).

Is this idea possible to be realized on one Glassfish instance with hundred applications deployed (enabled on instance/virtual host)? Maybe deploying applications under different names (like described here: home.java.net/node/676678) might be a good solution in my case? Does anybody have an experience in deploying one hundred times the same application with different configurations that way?

Thanks,

Olgierd

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暮色兮凉城 2025-01-09 10:13:58

如果您使用 GF 3 堆栈,您会注意到该产品经过重构以从 OSGi 架构中受益。因此,现在您可以在 GF3 中部署捆绑包甚至 .wab 文件(Web 应用程序捆绑包)。此架构将使您能够:

  • 管理不同模块的版本
  • 以独立停止/重新启动应用程序
  • ,为您的应用程序提供通用捆绑包,避免浪费永久代空间...

但在您的问题中,我无法理解如何使用单个Java虚拟机对不同的进程进行建模。 ... 一虚拟机意味着 1 个进程(在操作系统级别),您对此无能为力。OSGi

平台为您的应用程序和软件模块化的 SLA 要求带来了许多优势...
华泰
杰罗姆

if you use the GF 3 stack you will notice that this product was refactored to take benefits from the OSGi architecture.. So now you can deploy bundles or even .wab files (web application bundles) in GF3.This architecture will enable you to :

  • manage versions of the different modules
  • to stop/restart applications independently
  • to provide common bundles for your applications avoiding a waste of perm gen space...

But in your question I can't understand how to model different processes with a single Java Virtual Machine.... One Virtual Machine means 1 process (at the OS level) and you can't do anything against that..

The OSGi platform brings you many advantages regarding SLA requirements for your applications and for software modularity...
HTH
Jerome

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文