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 and need to be manually changed to reflect your new VM size.
The Memory Settings were changed in version 1.1.0
of StorageLink. Make sure to follow the instructions for your version of StorageLink or the application (Java) may fail when restarted.
Memory Settings Location - 1.1.0 & Newer
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="-Xms256m -Xmx3900m -server -Daws.crt.lib.dir=/opt/swiftgw/tmp -Djava.io.tmpdir=/opt/swiftgw/tmp"
The aspect you want to focus on is -Xmx3900m, otherwise known as the MAX_RAM value.
The value of 3900m
in this case is 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
MAX_RAM="22014"
# 16 GB
MAX_RAM="9937"
# 8 GB
MAX_RAM="3900"
# 4 GB
MAX_RAM="1903"
# 2 GB
MAX_RAM="1024"
To apply your changes, restart Java:
service swiftgateway restart
Memory Settings Location 1.0.3 & Older
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