简体   繁体   中英

Container Options in AWS Elastic Beanstalk

We have deployed a java webapplication in Elastic Beanstalk with the minimum instance count 1 and max instance count 2 for Autoscaling. The custom AMI we are using is c1.medium with Sun JDK 6.

The environment status changed to yellow and then red. After checking into the log file from the snapshot logs we found a exception - Caused by: java.lang.OutOfMemoryError: Java heap space. Assuming this could be one of the possible reason for the Environment failure. The settings that we have configured in the Environment Container option are

Initial JVM Heap Size (MB) - 256M

Maximum JVM Heap Size (MB) - 512m The maximum heap size the java virtual machine will ever consume, specified on the JVM launch command line using -Xmx.

Maximum JVM Permanent Generation Size (MB) - 512m

Should i increase the Heap size from 512m to more or is it fine.

I think your maximum JVM Permanent Generation Size is too big. Here is the 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

I found this Rimuhosting how-to article quite good in explaining Xmx settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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