AWS:Java 运行时环境内存不足,无法继续

AWS: There is insufficient memory for the Java Runtime Environment to continue

我 运行 64bit Amazon Linux 2016.09 v2.5.2 running Tomcat 8 Java 8 环境 AWS Elasticbeanstalk 免费套餐(实例类型:t1.micro)。

我有很多 RESTful 服务,当一个特定的服务被调用时,它做了一些工作,我总是得到一个 502 error,并且在日志中有以下内容:

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e2220000, 130215936, 0) failed; error='Cannot allocate memory' (errno=12)

There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 130215936 bytes for committing reserved memory. An error report file with more information is saved as: /tmp/hs_err_pid31500.log OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=64m; support was removed in 8.0

问题

这是否意味着我需要升级到付费版本,即大于实例类型:t1.micro

或者,有没有办法配置我的环境来处理这个问题?

我问的原因是因为上面的日志表明 Java 应用程序只需要 130mb (130215936 bytes) 的内存,下面你可以看到 JVM heap尺寸要大很多。所以我没想到它会在 130mb.

掉下来

更多信息

我有以下配置设置:

谢谢

更新

我将 Max JVM 更改为 256mb,但仍然出现错误:

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 89456640, 0) failed; error='Cannot allocate memory' (errno=12)

There is insufficient memory for the Java Runtime Environment to continue. Native memory allocation (mmap) failed to map 89456640 bytes for committing reserved memory. An error report file with more information is saved as: /tmp/hs_err_pid14014.log OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0

但这里它只落在 89mb

根据您更新中的错误消息,您似乎试图调整 JVM 永久代大小。尝试将此设置保留为默认值。相反,将初始堆大小和最大堆大小都设置为 64mb。

如果还是死机,一旦死机,你可以ssh到AWS实例,看看是什么占用了内存。在 beantalk 中,在您的环境配置中,在 "Instances" 下,您可以 select 您想要与您的实例一起使用的密钥对。您可以在 EC2 控制台中找到 beantalk 启动的实例,就像任何其他实例一样。