Virtual Machine Memory Settings
Overview
In this article we will be going over the memory settings of StorageLink and how to change them. This can be important if you resize your VM, as the memory settings will not automatically update.
Memory Settings Location
To check the memory settings for StorageLink, you can run this command:
cat /opt/swiftgw/swiftgateway-*.conf
You will see something like this:
RUN_ARGS=--spring.config.additional-location=/opt/swiftgw/application.properties
JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -server -Daws.crt.lib.dir=/opt/swiftgw/tmp -Djava.io.tmpdir=/opt/swiftgw/tmp"
The main values you want to focus on are -Xms128m -Xmx512m -XX:MaxPermSize=256m.
The values of 128m
, 512m
and 256m
in this case are based on the size of the VM when it's first instantiated.
The amount of RAM you have now may be different if you've ever resized the VM. So, you can use these values as guidelines, depending on the amount of RAM you currently have:
# 32 GB
MIN_RAM="4096"
MAX_RAM="16384"
MAX_PERM="8192"
# 16 GB
MIN_RAM="2048"
MAX_RAM="8192"
MAX_PERM="4096"
# 8 GB
MIN_RAM="1024"
MAX_RAM="4096"
MAX_PERM="2048"
# 4 GB
MIN_RAM="512"
MAX_RAM="2048"
MAX_PERM="1024"
# 2 GB
MIN_RAM="256"
MAX_RAM="1024"
MAX_PERM="512"
# 1 GB
MIN_RAM="128"
MAX_RAM="512"
MAX_PERM="256"
# 512 MB
MIN_RAM="128"
MAX_RAM="256"
MAX_PERM="128"
After editing the conf file, to apply your changes, restart Java:
service swiftgateway restart