Tomcat 每个 webapp 内存设置

发布于 2024-08-13 05:14:26 字数 191 浏览 4 评论 0原文

我有两个 web 应用程序在 tomcat 中运行。 Java 堆空间是为 Tomcat 分配的,并且由两个应用程序共享。其中一个应用程序消耗更多内存,而其他应用程序则耗尽内存。

有没有办法为每个 Web 应用程序设置内存设置。假设一个 Web 应用程序占分配给 Tomcat 的总内存的 70%,其他应用程序占 30%。

问候 加内什

I am having two webapplication running inside tomcat. Java Heap space is allocated for Tomcat and it is shared for both appliaction. In that one application consumes more and other is getting OUT_OF_MEMORY.

Is there any way to set memory settings per web application. Say 70% for one webapp and 30% for other from the overall memory allocated to Tomcat.

Regards
Ganesh

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

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

发布评论

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

评论(2

秉烛思 2024-08-20 05:14:26

内存是按 JVM 实例定义的,因此如果您使用一个 tomcat,则无法执行此操作。

不过,您可以运行两个 tomcat 实例(每个 Web 应用程序一个),然后您可以更好地控制每个 Web 应用程序的内存分配。

The memory is defined per JVM instance, so if you are using one tomcat you cannot do it.

However you can run two tomcat instances - one per web application - and then you will finer control on memory allocation for each webapp.

掩于岁月 2024-08-20 05:14:26

不可以。Java 代码的某些部分无法控制从代码的第一部分调用的其他代码部分对内存的消耗。换句话说,Web 容器只是一个 Java 程序,它调用应用程序中的其他一些 Java 类方法。

所以唯一的控制权就是 JVM 参数。这个参数只是为了暗示 JVM 大约会在哪里因内存不足错误而失败。不,这是不可能的。

No. There is no way for some portion of java code to control the consumption of memory by other portion of code called from first portion of code. In other words, the web container is just a java program which calls some other java class methods found in application.

So the only control one has is JVM arguments. And this arguments are only to hint the JVM where approximately to fail with out of memory error. No, it is not possible.

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