To enable the new G1GC setting, we work with script_env.sh (UNIX) or script_env.bat (Windows).
If script_env is not implemented, follow the below steps:1. Navigate to [TDV_Server_Install_dir]\conf folder.
2. Copy [TDV_Server_Install_dir]\conf\script_env.sh.sample (or .bat for Windows) and create new file named script_env.sh (or .bat) in the same directory.
3. Open script_env.sh with a text editor and to uncomment (remove “rem” for windows/ remove '#' for UNIX) from the line that contains:
rem set CIS_SERVER_VM_ARGS
4. Change the value of CIS_SERVER_VM_ARGS to include values in <os>vmargs="..." (<os>: current operating system) from [TDV_Server_Install_dir]\conf\server\server.properties file.
Eg: set CIS_SERVER_VM_ARGS="-server -XX:NewRatio=6 -XX:-UseGCOverheadLimit -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=[TDV_Server_Installation_dir]/logs -XX:-ReduceInitialCardMarks -XX:+ExplicitGCInvokesConcurrent -XX:+UseConcMarkSweepGC -Xmx2048m"
(b) Paste this value in the script_env.sh for CIS_SERVER_VM_ARGS and save the changes.
After script_env is implemented, follow the below steps:1. Replace the old GC settings with the new values.
Old values:
-XX:NewRatio=6 -XX:-UseGCOverheadLimit -XX:PermSize=64m -XX:MaxPermSize=1024m -XX:-ReduceInitialCardMarks -XX:+ExplicitGCInvokesConcurrent -XX:+UseConcMarkSweepGC
New values:
-XX:+UseG1GC -XX:MaxGCPauseMillis=200
2. Save file with new changes.
For Windows OS it will look something like the following. The Xmx memory setting and HeapDumpPath will be different, and other OSes will have different settings as well:
set CIS_SERVER_VM_ARGS="-server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=[TDV_Server_Install_dir]/logs -Xmx385024m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"
3. Restart the TDV server.
4. Verify the changes from [TDV_Server_Install_dir]\logs\cs_monitor.out log file. You should see lines similar to this:
ServerPropertiesManager : Detected [TDV_Server_Installation_dir]\conf\script_env.bat
ServerPropertiesManager : Detected CIS_SERVER_VM_ARGS environment variable overrides VM_ARGS
ServerPropertiesManager : Changing VM_ARGS to "-server -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=[TDV_Server_Installation_dir]/logs -Xmx2048m -XX:+UseG1GC -XX:MaxGCPauseMillis=200"