gpt4 book ai didi

java - AWS Elastic Beanstalk 中的容器选项

转载 作者:行者123 更新时间:2023-12-01 15:26:57 26 4
gpt4 key购买 nike

我们已在 Elastic Beanstalk 中部署了一个 Java Web 应用程序,自动扩展的最小实例计数为 1,最大实例计数为 2。我们使用的自定义 AMI 是带有 Sun JDK 6 的 c1.medium。

环境状态先变为黄色,然后变为红色。从快照日志检查日志文件后,我们发现了一个异常 - Caused by: java.lang.OutOfMemoryError: Java heap space。假设这可能是环境失败的可能原因之一。我们在环境容器选项中配置的设置是

初始 JVM 堆大小 (MB) - 256M

最大 JVM 堆大小 (MB) - 512mjava 虚拟机将消耗的最大堆大小,在 JVM 启动命令行上使用 -Xmx 指定。

最大 JVM 永久代大小 (MB) - 512m

我应该将堆大小从 512m 增加到更大吗?

最佳答案

我认为您的最大 JVM 永久代大小太大。这是documentation of AWS :

JVM Options

The heap size in the Java Virtual Machine affects how many objects can be created in memory before garbage collection—a process of managing your application’s memory—occurs. You can specify an initial heap size and a maximum heap size. A larger initial heap size allows more objects to be created before garbage collection occurs, but it also means that the garbage collector will take longer to compact the heap. The maximum heap size specifies the maximum amount of memory the JVM can allocate when expanding the heap during heavy activity.

In the Edit Configuration window, you can set the initial and the maximum JVM heap sizes using the Initial JVM Heap Size (MB) and Maximum JVM Heap Size (MB) boxes. The available memory is dependent on the Amazon EC2 instance type. For more information about the Amazon EC2 instance types available for your AWS Elastic Beanstalk environment, go to Instance Families and Types in the Amazon EC2 User Guide.

The permanent generation is a section of the JVM heap that is used to store class definitions and associated metadata. To modify the size of the permanent generation, type the new size in the Maximum JVM Permanent Generation Size (MB) box

我找到了这个Rimuhosting how-to article很好地解释了 Xmx 设置。

关于java - AWS Elastic Beanstalk 中的容器选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10042545/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com