Friday, April 3, 2015

amazon ec2 - Not able to change tomcat memory on AWS Ubunutu 16



Ok so this is a very odd behaviour. Setting jvm parameters -Xms6g -Xmx6g has no affect on tomcat. Tomcat doesn't allocate memory when checked with free -m or with top.




I'm using




  • Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-7c412f13


  • tomcat8


  • oracle java 1.8




Just to eliminate any doubts about parameters not getting picked by service daemon. I'm starting tomcat manually.




sudo /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat8/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Xms6g -Xmx6g -Djava.endorsed.dirs=/usr/share/tomcat8/endorsed -classpath /usr/share/tomcat8/bin/bootstrap.jar:/var/lib/tomcat8/bin/tomcat-juli.jar -Dcatalina.base=/var/lib/tomcat8 -Dcatalina.home=/usr/share/tomcat8 -Djava.io.tmpdir=/tmp/tomcat8-tomcat8-tmp org.apache.catalina.startup.Bootstrap start



Could it be something wrong on OS or AMI level?


Answer



This can be fixed with adding -XX:+AlwaysPreTouch as JVM parameter.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...