-
Notifications
You must be signed in to change notification settings - Fork 12
EnvironmentConfiguration
The service environment configuration is controlled with an rcloud-gist-service-<version>.conf
file that by convention sits next to the application jar file.
The default configuration file shipped with the service looks like this:
#*******************************************************************************
# Copyright (c) 2017 AT&T Intellectual Property, [http://www.att.com]
#
# SPDX-License-Identifier: MIT
#
#******************************************************************************/
MAX_MEM=512m
MIN_MEM=64m
JAVA_OPTS="${JAVA_OPTS} -Xms${MIN_MEM} -Xmx${MAX_MEM}"
# Increase maximum perm size for web base applications to 4x the default amount
# http://wiki.apache.org/tomcat/FAQ/Memoryhttp://wiki.apache.org/tomcat/FAQ/Memory
JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256m"
# Reset the default stack size for threads to a lower value (by 1/10th original)
# By default this can be anywhere between 512k -> 1024k depending on x32 or x64
# bit Java version.
# http://www.springsource.com/files/uploads/tomcat/tomcatx-large-scale-deployments.pdf
# http://www.oracle.com/technetwork/java/hotspotfaq-138619.html
JAVA_OPTS="${JAVA_OPTS} -Xss228k"
# Oracle Java as default, uses the serial garbage collector on the
# Full Tenured heap. The Young space is collected in parallel, but the
# Tenured is not. This means that at a time of load if a full collection
# event occurs, since the event is a 'stop-the-world' serial event then
# all application threads other than the garbage collector thread are
# taken off the CPU. This can have severe consequences if requests continue
# to accrue during these 'outage' periods. (specifically webservices, webapps)
# [Also enables adaptive sizing automatically]
JAVA_OPTS="${JAVA_OPTS} -XX:+UseParallelGC"
# This is interpreted as a hint to the garbage collector that pause times
# of <nnn> milliseconds or less are desired. The garbage collector will
# adjust the Java heap size and other garbage collection related parameters
# in an attempt to keep garbage collection pauses shorter than <nnn> milliseconds.
# http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
JAVA_OPTS="${JAVA_OPTS} -XX:MaxGCPauseMillis=1500"
# A hint to the virtual machine that it.s desirable that not more than:
# 1 / (1 + GCTimeRation) of the application execution time be spent in
# the garbage collector.
# http://themindstorms.wordpress.com/2009/01/21/advanced-jvm-tuning-for-low-pause/
JAVA_OPTS="${JAVA_OPTS} -XX:GCTimeRatio=9"
# The hotspot server JVM has specific code-path optimizations
# which yield an approximate 10% gain over the client version.
JAVA_OPTS="${JAVA_OPTS} -server"
# Disable remote (distributed) garbage collection by Java clients
# and remove ability for applications to call explicit GC collection
JAVA_OPTS="${JAVA_OPTS} -XX:+DisableExplicitGC"
# LOG file is not in default location
LOG_FOLDER=/var/log/rcloud-gist-service
Spring Boot checks the following locations (in the specified order) for Java:
-
$JAVA_HOME/bin/java
(if$JAVA_HOME
variable is set) -
java
command resolved using$PATH
/usr/bin/java
If java is not found at any of the above locations, the service will fail to start up.
To set $JAVA_HOME
in the environment configuration file, add the following line:
JAVA_HOME=/path/to/java/home/directory
To change maximum and minimum Java heap space, update the following variables:
MAX_MEM=512m
MIN_MEM=64m
Please refer to Java documentation for the values that are accepted by -Xms
and -Xmx
options.
To change PermGen space, please update the following line:
JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256m"
By default the service uses Parallel Garbage Collector, however in case when other Garbage Collector implementation is needed (e.g. G1 GC) the following changes need to be made to the .conf
file:
- turn off the
Parallel Garbage Collector
, by editing appropriate line:
JAVA_OPTS="${JAVA_OPTS} -XX:-UseParallelGC"
- add the following line underneath it:
# Use Garbage First Garbage Collector and use Java 8 String de-duplication feature
JAVA_OPTS="${JAVA_OPTS} -XX:+UseG1GC -XX:+UseStringDeduplication"
Please refer to Garbage Collection Tuning for available Garbage Collector implementations and additional JVM options that control their behaviour.