简体   繁体   English

JVM内存不足问题

[英]JVM insufficient memory issue

I'm getting this when I try to push my Tomcat project to IBM Cloud:当我尝试将我的 Tomcat 项目推送到 IBM Cloud 时,我得到了这个:

Cannot calculate JVM memory configuration: There is insufficient memory remaining for heap.无法计算 JVM 内存配置:堆剩余内存不足。 Memory available for allocation 256M is less than allocated memory 578931K(-XX:ReservedCodeCacheSize=240M,-XX:MaxDirectMemorySize=10M, XX:MaxMetaspaceSize=66931K, Xss1M * 250 threads)可分配内存256M小于分配内存578931K(-XX:ReservedCodeCacheSize=240M,-XX:MaxDirectMemorySize=10M, XX:MaxMetaspaceSize=66931K, Xss1M * 250 个线程)

I cannot increase the memory limit.我无法增加内存限制。 I tried using JVM flags to reduce the JVM's memory usage in manifest.yml file:我尝试使用 JVM 标志来减少 manifest.yml 文件中 JVM 的内存使用量:

env:
    JAVA_OPTS: '-XX:MaxMetaspaceSize=80780K -Xss160k -Xmx200M -XX:ReservedCodeCacheSize=16M -XX:MaxDirectMemorySize=16M'

and tried to use an older version of java buildpack, also in manifest.yml file:并尝试使用旧版本的 java buildpack,也在 manifest.yml 文件中:

buildpack: https://github.com/cloudfoundry/java-buildpack#v3.19.2 

but I got errors doing both things.但是我在做这两件事时都出错了。 What can I do to solve this?我能做些什么来解决这个问题?

You can try to reduce your Tomcat max thread pool to the minimum as the default is 200. Of course it would really reduce its concurrency and limit the access to the web server to a very limited number of users.您可以尝试将 Tomcat 最大线程池减少到最小值,因为默认值是 200。当然,这确实会降低其并发性并将对 Web 服务器的访问限制为非常有限的用户数。

Unfortunately the Java footprint for a web server is quite high and with the recent CF buildpacks I was not able to startup a server with less than 1GB of memory (well, I was, but not for production purposes).不幸的是,Web 服务器的 Java 占用空间非常大,并且使用最近的 CF buildpack 我无法启动内存少于 1GB 的服务器(嗯,我是,但不是用于生产目的)。

Facing the same issue?面临同样的问题?

env: -JAVA_OPTS: '-XX:MaxMetaspaceSize=80780K -Xss160k -Xmx200M -XX:ReservedCodeCacheSize=16M -XX:MaxDirectMemorySize=16M' -JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {stack_threads: 10, memory_sizes: {stack: 512k}}]' env: -JAVA_OPTS: '-XX:MaxMetaspaceSize=80780K -Xss160k -Xmx200M -XX:ReservedCodeCacheSize=16M -XX:MaxDirectMemorySize=16M' -JBP_CONFIG_OPEN_JDK_JRE: '[memory_calculator: {5s10,threadstack} {stack_threadstack}内存'

used this in manifest.yml file在 manifest.yml 文件中使用它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM