Skip to content

Alibaba Dragonwell8 User Guide

kuaiwei edited this page Mar 19, 2019 · 42 revisions

Introduction

Over the years, more than a billion lines of Java code have been written in Alibaba. While adopting OpenJDK to run these applications, we have found a need to customize it specifically for large-scale Java application deployments. Our customization has been well tested in our environment. We are now contributing some of our work into the Java community.

Alibaba Dragonwell, as a downstream version of OpenJDK, is the in-house OpenJDK implementation at Alibaba. It is optimized for online e-commerce, financial and logistics applications running on 100,000+ servers. Alibaba Dragonwell is the engine that runs these distributed Java applications in extreme scaling.

Alibaba Dragonwell is certified as compatible with the Java SE standard. The current release supports Linux/x86_64 platform only.

Alibaba Dragonwell is a "friendly fork" under the same licensing terms as the upstream OpenJDK project. Alibaba is committed to collaborate closely with the OpenJDK community. We intend to bring as many customized features as possible from Alibaba Dragonwell to the upstream.

Using Alibaba Dragonwell

Alibaba Dragonwell JDK currently supports Linux/x86_64 platform only.

Installation

Two options to install Alibaba Dragonwell are described below.

  • Option 1: Download and install pre-built Alibaba Dragonwell
  • Option 2: Install via YUM (Please stay tuned, will be available soon) Supports RedHat, CentOS, and AliOS only.
    • Add Aliyun's RPM repository to your /etc/repos.d/.
    • Install Alibaba Dragonwell using YUM: yum install dragonwell-8

Enable Alibaba Dragonwell for Java applications.

To enable Alibaba Dragonwell JDK for your application, simply set JAVA_HOME to point to the installation directory of Alibaba Dragonwell.

JWarmup

The rationale in JWarmup is to record profiling data in a "previous run" including hot compiled methods, ordering of class initialization, etc. In a later "normal run", the JVM would eagerly load and resolve these classes based on the recorded profiling data, and proactively use C2 to compile the related methods.

The typical usage is showed as above:

  • In beta stage, the profiling data is recorded and stored into a file on disk with the generated loads.
  • In production stage, JVM proactively loads, resolves related classes and compiles the hot methods

Example Usage

  1. In beta stage, use the JVM options as below (assuming CMS is used):
-XX:-ClassUnloading -XX:-CMSClassUnloadingEnabled -XX:-ClassUnloadingWithConcurrentMark -XX:CompilationWarmUpLogfile=jwarmup.log -XX:+CompilationWarmUpRecording -XX:CompilationWarmUpRecordTime=300

Caveats: The recording model does not support class unloading for now.

  1. In production stage, use the JVM options as below: -XX:+CompilationWarmUp -XX:-TieredCompilation -XX:CompilationWarmUpLogfile=jwarmup.log -XX:+CompilationWarmUpExplicitDeopt

Caveats: The warmup model does not support tiered compilation for now.

  1. Trigger compilation at appropriate time after all necessary initialization work of your application is done, call the following API to notify JVM: com.alibaba.jwarmup.JWarmUp.notifyApplicationStartUpIsDone() After that, the methods will be compiled by JVM proactively.

Java Flight Recorder

Java Flight Recorder (JFR) is a tool to collect diagnostic and profiling data for Java applications. It is closely integrated into JVM and its performance overhead is minimal. The overhead is negligible if the default JFR config (-XX:+EnableJFR) is enabled.

In Alibaba Dragonwell, an option called "EnableJFR" is used to enable/disable the JFR feature. It's disabled by default. To enable JFR, you may start java with "-XX:+EnableJFR". For example: java -XX:+EnableJFR -XX:StartFlightRecording=duration=1m,filename=rec.jfr MyApp

When running the JTreg test, please add the extra option -vmoption:-XX:+EnableJFR. Otherwise the test case will not run correctly. Here is an example of running JFR JTreg test: make test JTREG_TEST_EXTRA_OPTIONS=-vmoption:-XX:+EnableJFR TEST=jdk_jfr

Java Mission Control (JMC) is the GUI to analyze JFR results. Please use JMC version 7.0 or later version to open the JFR record file. Currently, you can not use JMC to control JFR. But it will be supported in the future. More details on JFR and JMC are available on the Oracle website.

Serviceability

  1. Mini-Heapdump support With Alibaba Dragonwell you may dump partial Java heap by omitting the content of all primitive type arrays. A new option mini is added to the sub-command -dump of jmap tool. An example: jmap -dump:live,mini,format=b,file=heap121.bin <PID>

  2. PrintYoungGenHistoAfterParNewGC The flag will print the histogram of the young generation after a ParNew GC. It is supported in jinfo : jinfo -flag +PrintYoungGenHistoAfterParNewGC <PID>

  3. -XX:+PrintGCRootsTraceTime The flag will print the details of the ParNew GC phase. It helps user to find the problem of long GC pause time. This flag could be enabled by jinfo:

jinfo -flag +PrintGCRootsTraceTime <pid> // turn on the flag
jinfo -flag -PrintGCRootsTraceTime <pid> // turn off the flag
  1. Fixed incorrect metaspace usage after full GC Metaspace usage in the GC log are not correctly updated after a full GC. This issue has been fixed in Alibaba Dragonwell.

  2. -XX:ArrayAllocationWarningSize= The flag will print the calling stack of an array allocation if the allocation size is greater than the ArrayAllocationWarningSize. The default value is 512M, this flag could be enabled by jinfo:

// print the allocation stack if more than 1M array allocated.
jinfo -flag ArrayAllocationWarningSize=1048576 <pid>
// back to default value(512M)
jinfo -flag ArrayAllocationWarningSize=536870912 <pid>

Support

Please take a look at Alibaba Dragonwell FAQ for support. Or send mail to [email protected] for more help. Or you may scan QR code below with DingTalk to join the group chat.

Clone this wiki locally