...
The Z Garbage Collector (ZGC) is a scalable low latency garbage collector for Java 12. ZGC performs all expensive work concurrently, without stopping the execution of application threads for more than 10 milliseconds, which makes it suitable for applications requiring low latency and/or use a very large heap. It should be noted that ZGC requires more processor resources than CMS GC.
Example of installing of ZGC with OpenJDK version 12:
1. Download the latest release of OpenJDK 12 from http://jdk.java.net/12/:
Code Block | ||||
---|---|---|---|---|
| ||||
wget https://download.java.net/java/GA/jdk12.0.2/e482c34c86bd4bf8b56c0b35558996b9/10/GPL/openjdk-12.0.2_linux-x64_bin.tar.gz |
2. Extract the archive to folder and move its contents to the working directory:
Code Block | ||||
---|---|---|---|---|
| ||||
tar xvf openjdk-12.0.2_linux-x64_bin.tar.gz
mv jdk-12.0.2 /usr/java/jdk-12.0.2 |
3. Create symbolic links to OpenJDK 12:
Code Block | ||||
---|---|---|---|---|
| ||||
ln -sfn /usr/java/jdk-12.0.2 /usr/java/default
ln -sfn /usr/java/default/bin/java /usr/bin/java
ln -sfn /usr/java/default/bin/jstack /usr/bin/jstack
ln -sfn /usr/java/default/bin/jcmd /usr/bin/jcmd
ln -sfn /usr/java/default/bin/jmap /usr/bin/jmap
|
41. Install JDK 12 or 14 as described here
2. Verify your Java installation:
Code Block | ||||
---|---|---|---|---|
| ||||
java -version openjdk 12.0.2 2019-07-16 OpenJDK Runtime Environment (build 12.0.2+10) OpenJDK 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing) |
53. Install WCS (if required).
64. If WCS is already installed, comment or remove the following lines in wcs-core.properties file
...
Code Block | ||
---|---|---|
| ||
-Xlog:gc*:/usr/local/FlashphonerWebCallServer/logs/gc-core-:time |
75. Tune the wcs-core.properties (for example, allocating 24G under memory heap):
Code Block | ||
---|---|---|
| ||
# ZGC -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xms24g -Xmx24g -XX:+UseLargePages -XX:ZPath=/hugepages |
86. Сonfigure ZGC according to the recommendations (the number of memory pages (2048K each) with a margin to the memory for heap (1,125 * 24G * 1024 / 2M)) and add the required parameters in the server startup:
Code Block | ||||
---|---|---|---|---|
| ||||
mkdir /hugepages echo "echo 13824 >/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages" >>/etc/rc.local echo "mount -t hugetlbfs -o uid=0 nodev /hugepages" >>/etc/rc.local chmod +x /etc/rc.d/rc.local systemctl enable rc-local.service systemctl restart rc-local.service |
97. After restarting the WCS, the gc-core.log log files show the periodic operation of the garbage collector. To understand the working model of Z Garbage Collector, you can see this presentation.
...