Friday, October 12, 2018

What Java -Xmx setting can I reasonably expect to work on an AWS EC2 Ubuntu server?


  • What is your experience? Can you confirm my experimental findings?

  • Can I generally use total RAM - 600 MB, or 0.4 * total RAM?

  • Or is it always trial and error, and hoping that it is low enough?



Context: I'm trying to set up jenkins on a T3 instance, experimenting with Ubuntu Server 16.04 and 18.04.




I started with a t3.micro instance (1 GB RAM), but found the OOM killer killing my java process, as soon as I use more than about -Xmx400m, which seems kind of low. I was expecting to be able to use more like -Xmx750m.



Does this mean Ubuntu Server requires about 600 MB to work?



The problem is that the java process starts, even if I set both -Xms and -Xmx to a very high value, like 700m. The process is killed only later when I make the first request to the website.



I now experiment with a t3.small instance (2 GB of RAM), but am again very unsure about what to configure.



On Windows it is kind of deterministic: I set both -Xms and -Xmx to the same value. If the service fails to start, the value was too high. If the service starts successfully, the value is fine, and the memory is reserved for my process.




Some background:

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...