简体   繁体   中英

AWS Elastic Beanstalk and JAVA_OPTS

I have a java application which is deployed to Elastic Beanstalk. There are two environments: test and production, production is configured to use bigger instances than test. With the default config for java environment max heap size is around 1/4 of all instance RAM (for 2G RAM instance it's about 0.5G) and I'd like to increase it ( -Xmx ). Available options are:

  • using .ebextensions - this way config for both environment will be the same (not good)
  • using Procfile - the same as above
  • using Environment properties in console does not work - those properties are passed to application ( -D ), not to java .

Any ideas how to set -Xmx depending on environment / available memory size? Thanks

I think of two ways to resolve the issue:

  1. two sets of .ebextensions , one for test and one for prod , when you do the app package, just put .ebextensions under webapp folder, it will be picked up by Beanstalk

  2. customized catalina.sh to grep the free memory and adjust the -Xmx accordingly.

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