Tuesday, 21 April 2020

Java heap space issue on ubuntu 18.04 with Tomcat

Setting up Swap Memory:

Check Swap Memory:

1) sudo swapon --show

Creating a Swap File


2): sudo fallocate -l 1G /swapfile

sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576

3) sudo chmod 600 /swapfile

4) sudo mkswap /swapfile

5) sudo swapon /swapfile

Make the changes permanent, use following commands

6) sudo vi /etc/fstab

7) /swapfile swap swap defaults 0 0

8) Verify: sudo swapon --show

9) Check swam memory:
sudo free -h


In Tomcat setenv.sh add the xms and xmx parameters like following.

CATALINA_OPTS="-Djava.net.preferIPv4Stack=true -Xms256M -Xmx1024M"

No comments:

Post a Comment