Tomcat 上的多个 Grails 应用程序

发布于 2024-08-19 12:21:25 字数 251 浏览 4 评论 0原文

我即将在单个 Tomcat 服务器上部署多个 grails 应用程序,我有以下疑问:

  1. 在内存使用方面:将通用的 grails 库放在共享/lib 下而不是放在每个应用程序的战争文件?有这些罐子的清单吗?
  2. 如果是这样,是否有一种机制不将这些 jar 打包到“生产”环境的 war 文件中?我正在使用 NetBeans 6.7。
  3. 我即将使用 Tomcat 5.5;有没有推荐使用6.0的经验?

谢谢

I'm about to deploy several grails apps on top of a single Tomcat server, and I have the following doubts:

  1. In terms of memory usage: Does it make a difference to put the common grails libs under shared/lib instead of putting them in each app's war files? Is there a list of those jars ?
  2. If so, is there a mechanism not to package those jars in the war file for the "production" environment? I'm using NetBeans 6.7.
  3. I'm about to use Tomcat 5.5; are there any experiences that recommend to use 6.0 instead?

Thanks

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

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

发布评论

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

评论(2

撕心裂肺的伤痛 2024-08-26 12:21:25

我认为最佳实践是让库保持在战争中,因为如果您更新共享的库,那么您就必须确保它与使用它的所有应用程序兼容。我们通常使用 grails 和 spring 来做到这一点,这样我们就不必在每次升级时返回并进行兼容性测试。

我还相信 tomcat 会为每个应用程序加载该类的实例,因此您不会通过将其用作公共类来节省内存。

另请参阅:

如果同一个库文件位于两个 Web 应用程序中,Tomcat 是否会将同一个库文件加载到内存中两次?

I think best practices are to keep the libraries in the war, because if you update a library that's shared then you have make sure it's compatible with all of your apps that are using it. We do this with grails and with spring in general that way we don't have to go back and do compatibility testing each time we upgrade.

Also I believe that tomcat loads an instance of the class per application so you don't save on memory by using it as a common class.

See also:

Does Tomcat load the same library file into memory twice if they are in two web apps?

划一舟意中人 2024-08-26 12:21:25

1) 将 jar 放在共享/lib 或 common/lib 中可能会减少 PermGen 所需的内存量。恕我直言,最大的优点是上传 war 文件更快。
但请记住,TripWird 所说的共享 jar 将所有已部署的应用程序绑定到同一个 grails 版本。升级变成了“全无”的游戏。

2)如果你使用

grails prod war --nojars

那么所有jar文件都会被排除在war之外。

1) putting the jars in shared/lib or common/lib might reduce the amount of memory required in PermGen. IMHO the greatest advantage is that uploading the war file is much more faster.
But keep in mind, what TripWird said, shared jars ties all the deployed apps to the same grails version. Upgrading becomes a "nothing-or-all" game.

2) if you use

grails prod war --nojars

then all jar file are excluded from the war.

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