Java is Youth: Status Quo and Technology Trend Report

background

In 1991, James Gosling led the team to start a project called "Oak", which was the predecessor of Java. In 1995, Java 1.0 was released. The Java slogan "Write once, run anywhere" must be familiar to everyone. When Java first appeared, it was mainly oriented to the field of Interactive Television, until the development of the next few years. At that time, SUN (later acquired by Oracle in 2010) once wanted to use Java to build a desktop network operating system, replacing the ubiquitous Windows at that time. However, the subsequent development of Java did not think that although it did not make much achievements in the desktop field, unexpectedly, it blossomed in the field of enterprise-level applications and occupies almost the dominant position today. The lost corner, but the Sang Yu.

JavaSE open source status

Sun announced the open source of Java technology at the Java One conference in 2006, and then released HotSpot and javac under the GPL agreement at the end of 2006. This is a milestone in the development of Java. Alibaba signed the OCA as early as 2012, and participated in the development of OpenJDK.

image.png

OpenJDK is JavaSE open source Reference Implementation. On Keynote of JavaOne 2017 (JavaOne was renamed CodeOne by Oracle in 2018), Oracle promised to open source all commercial implementation functions contained in OracleJDK [1].

image.png

In Java11 released in 2018, Oracle has made the binaries of OpenJDK and Oracle JDK as close as possible to each other in function, although there are still some differences between OpenJDK and OracleJDK in some options [2].

In addition, in addition to the main line of OpenJDK, in recent years, the open source of Java basic technology has become increasingly fierce: In 2017, IBM will open source the J9 virtual machine for more than 20 years internally and contribute to the Eclipse Foundation, and then in 2018 In 2010, Oracle's open source GraalVM 1.0, its core includes Just-in-Time compiler / Graal written in Java, SubstrateVM and Truffle framework that supports multilingual interpreters. The main motivation for open source for various enterprises is to build and benefit from a more powerful language ecosystem through open source.

The combination of cloud + open source allows ordinary developers to use and experience first-class tools (chains) at a lower threshold. Any company can use the same technology (democratizing) as any large organization. This is a developer Golden age.

Java is Still Free: What JDK should you choose?

Java is still free, but as the OracleJDK License changes and begins to charge, OpenJDK will gradually replace OracleJDK and become the mainstream of the market. This can also be seen from the JVM 2020 ecological report: OracleJDK has been used by 70% of developers in the previous year. To 34% in 2020.

OracleJDK charges also objectively exacerbate the fragmentation trend of the OpenJDK ecosystem, and several optional implementations based on OpenJDK, including Alibaba Dragonwell, have emerged.

When an enterprise chooses to use the JDK version of Java Vendor, several considerations can refer to:

  • Security and stability: Will the latest upstream updates be synchronized in a timely manner, including security patches, and key problem fixes?
  • JavaSE standard compatibility: whether it is compatible with standard Java.
  • Performance and efficiency: Is it possible to provide effective tool support in problem diagnosis and performance tuning to help frontline development students solve Java problems efficiently. In the JVM, to the JDK (Class library) level, are there any optimization features for enterprise business scenarios that can help improve the utilization of resources, the stability of production systems, etc.
  • Fast new technology adoption: With the charge, Oracle manages the Java version life cycle using the concept of Long Term Support (LTS). Oracle will specify a Java version of LTS every three years, and Java 8/11 are all LTS versions. Most enterprises, especially large and medium-sized enterprises, have difficulty keeping up with the rhythm of Java released every six months. Feature Release (FR) versions like Java 12, 13 are available. So the question is, if you choose Stay on the LTS version, such as Java 11, the JVM / JDK technology released in the new version (Java11 +), can you enjoy these technical dividends in advance without upgrading?

Here to share Alibaba Dragonwell's plans and thoughts on these aspects.

Alibaba Dragonwell is an open source version of AJDK (AlibabaJDK), which is widely used inside Alibaba. Alibaba Dragonwell serves as the cornerstone and supports almost all Java businesses in the Alibaba economy. Alibaba Dragonwell's main scenario is the optimization and improvement of the stability, efficiency, and performance of Java applications in the large-scale deployment of Java applications in the data center.

In March 2019, Alibaba Dragonwll 8.0.0 was opened by Alibaba. We have also been fulfilling the promise of open source. The features used in AJDK are gradually open source. Until just released Alibaba Dragonwell 8.3.3, we have open sourced JWarmup, ElasticHeap, multi-tenancy, JFR and many other functions. Coroutine Wisp 2.0, GCIH, etc. are also in open source planning.

image.png

At the same time, Alibaba Dragonwell as the downstream of OpenJDK, each release will synchronize the latest upstream updates, including security updates, problem fixes, etc., and have been tested by Alibaba's internal large-scale application cluster.

In terms of the new technology Adoption, Alibaba Dragonwell currently releases and maintains two LTS versions of Java 8, 11. The Alibaba JVM team will migrate Java 11+ related functions to Java 8 and 11 versions according to the actual business situation, so that Alibaba Dragonwell users can Without following up on FR versions such as Java 12, 13 etc., enjoy the technical dividends brought by these features in advance.

OpenJDK technology trends

Throughout the development of Java technology for more than 20 years, it has always revolved around two major themes: Productivity and Performance. In many cases, Java is better than Performance in design considerations. The Garbage Collector introduced by Java frees programmers from complex memory management, but on the other hand Java applications have always been plagued by the impact of GC pause time. Java is based on the design of the middle byte code of the stacking virtual machine, which abstracts the differences between different platforms (Intel, ARM, etc.) well. At the same time, the Just-in-Time (JIT) compilation technology solves the peak performance of Java applications. But on the other hand, JIT inevitably introduces the cost of Warmup. Under normal circumstances, Java programs always need to load class, explain and execute, and then execute to highly optimized code.

If we summarize from the perspective of JVM, the current OpenJDK community is happening, and the related incubation technologies are mainly summarized from four aspects: tools, GC, compiler, and runtime:

image.png

JFR / JMC

Oracle has open-sourced JFR, which has been a commercial feature from Java 11, and JFR is a powerful Java application problem diagnosis and performance profiling tool. Alibaba is also a major contributor. It has ported JFR to OpenJDK 8 together with the community including RedHat. It is expected that OpenJDK 8u262 (Java8), which will be released in July 2020, will have JFR function by default, so that Java 8 users can Based on this version, you can use the JFR function for free.

ZGC / Shandoath

Both the ZGC released by Oracle in Java 11 and the Shantoath that RedHat has been doing for several years have implemented concurrent copy GC to solve the GC downtime performance in the case of Large Heap. The latest status of ZGC. In JDK 15, which will be released in September, ZGC will be changed from Experimental function to production availability [3]. In fact, on AJDK 11, the JVM team of the Alibaba team has done a lot of ZGC migration from Java 11+ to Java 11, and related problem fixes. In 2019, Double 11 will work with the Alibaba database team to let database applications run on ZGC In the case of 100+ GB Heap, the GC pause time can be kept within <10ms, please refer to [4] for detailed discussion.

Graal

The new-generation Just-in-Time compilation technology developed in Java is used to replace the current C1 / C2 compiler of the HostSot JVM. The Ahead-of-Time (AOT) technology on OpenJDK is also based on the Graal compiler.

Loom

OpenJDK community coroutine project, corresponding to AJDK's Wisp 2.0 implementation, detailed discussion can refer to [5].

Attacking Java: Evolution towards the future

2020, standing on a brand new node, this article also looks at the future development from three major aspects: Cloud Native, AI, and multi-language ecology. Some discussions are beyond Java itself.

Language evolution for Cloud Native

In the cloud-native era, fundamental changes have taken place in the way software is delivered. Taking Java as an example, before Java developers delivered the application itself, it was specifically delivered in the form of "jar" and "war", while Cloud Native used Container as the delivery unit:

image.png

In terms of operation, the application requirements for Cloud Native:

  • Reactive
  • Always Watching
  • Extreme low memory footprint
  • Quick boot time

As the king of enterprise computing and the Internet, the Java language has consistency, a rich ecosystem built on the Java language, a rich tripartite library, and a variety of Serviceability support. With the application of microservices in the cloud era, Serverless, these The new architecture gradually touched the ceiling of Java program speed increase-Java's own startup overhead.

In the new context of Cloud Native, we are talking about the evolution of language, not just at runtime, at the compiler level, the new computing form must be accompanied by the transformation of programming models, which involves Library, Framework, Tools, etc. around the programming language A series of supporting reforms. From the current industry point of view, there are also many projects happening: Quarkus, Micronaut, and Helidon, the next generation programming frameworks with GraalVM / SVM (Java Static Compilation Technology), Quarkus has proposed "container first", the points they advocate The concept of lightweight uber-jar of the layer is in line with the trend of container delivery. The "Checkpoint Restore Fast Start-up" technology of the Red Hat Java team and the OS team (AZul also proposed a similar idea at the JVM Technology Summit '2019) is to solve the rapid pull of Java on a more low-level technology stack problem.

In the direction of Java for Cloud Native, we have also carried out related research and development work. Java is a static language, but contains a lot of dynamic features, including reflection, Class Loading, Bytecode Instrument (BCI), etc. These dynamic features are essentially in violation of the Closed-World Assumption (CWA) principle required by GraalVM / SVM, This is also the main reason why traditional Java applications running on the JVM are not easy to compile and run on the SVM. The Alibaba JVM team made a static cut of the AJDK, in order to find a certain boundary between the static and dynamic characteristics of Java, and provide the possibility of Java static compilation from the JDK level. At the same time, work together with the ant intermediate team to define a Java programming model for static compilation, constrained by the programming framework-the development of Java applications is oriented to static compilation friendly. We statically compiled the Meta Node application of the service registry built on the basis of the ant open source middleware SOFAStack. Compared with the traditional running on the JVM, the performance is improved by an order of magnitude: the service startup time is reduced by 17 times, and the executable file size is reduced. 3.4 times, the runtime memory is reduced by half. See [6] for details.

The rise of AI, a new challenge for heterogeneous computing in programming languages

In 2005, Justin Rattner, who was then Intel CTO, said "We are at the cusp of a transition to multicore, multithreaded architectures". In the past ten years, the field of programming languages ​​and compilers has been striving for parallel architectural paradigm Do optimization exploration. With the rise of AI in recent years, different time nodes and similar scenarios are oriented to FPGA / GPU heterogeneous computing scenarios, which poses new challenges in the field of programming languages ​​and compilers.

In addition to the automatic parallelizing work done by traditional Compilers such as IBM XL Compilers, Intel Compilers, etc., in terms of extreme performance exploration, the compilation optimization technology based on the polytope model (polytope model) as a means to solve program parallelization and data local optimization has become Research hotspots in the field of compilation optimization.

At the level of Parallel Languages, for C & C ++ developers, the emergence of CUDA lowers the threshold for GPU programming. However, the essential difference between the two hardware models of GPU and CPU leads to excessive development costs. You need to learn and understand more details of the underlying hardware. Not to mention the huge GAP between the underlying hardware models faced by higher-level language development languages ​​like Java and high-level languages.

In the field of Java, as early as the JVM Technology Summit '2014, AMD once shared their Sumatra project, trying to achieve JVM and Heterogeneous System Architecture target hardware interaction. In the recent TornadoVM project initiated by The University of Manchester, the implementation includes: a Just-in-Time compilation, supports mapping from Java bytecode to OpenCL, an optimized runtime engine, and can maintain the Java heap and heterogeneous devices Memory manager for heap memory consistency. The goal of TornadoVM is that developers do not need to know the GPU programming language or related GPU architecture knowledge to write heterogeneous parallel programs. TornadoVM can transparently run on AMD GPUs, NVIDIA GPUs, Intel integrated GPUs and multi-core CPUs.

In the field of general-purpose CPUs, the Vector API project of the OpenJDK community (a sub-project of Panama) relies on the SIMD instructions of the CPU to achieve exponential improvements in computing performance. The Vector API also has a very wide range of application scenarios in big data and AI computing. The Ali JVM team ported the Vector API to AJDK 11, and will open source it to Alibaba Dragonwell in the future, sharing the basic performance data we obtained:

image.png

The shorter the time (unit: milliseconds), the better the performance

Polyglot Programing, linking multilingual ecology

Polyglot Programming is not a new concept. In the field of Managed Runtime, in 2017 IBM open source Open Managed Runtime (OMR), and in 2018 Oracle open source Truffle / Graal technology. OMR and Graal technologies allow developers to achieve a significant reduction in the cost of a new language. The former OMR provides Garbage Collection (GC), Just-in-Time (JIT) and Reliability, availability and serviceability (RAS, tools), etc. in the form of C and C ++ components. Developers can rely on these components through the 'glue' Way to implement your own high-performance language based on these components. The latter Truffle / Graal, Truffle is a Java framework that relies on AST parser to implement a new language, essentially mapping your new language to the JVM world. Unlike Scala, JRuby, which are built around the JVM ecology itself, they are essentially Java. Whether it is OMR or Truffle / Graal, they provide production-level GC, JIT, and RAS service support. The newly developed language is completely There is no need to re-implement these underlying technologies.

From the industry point of view, Domain Specific Language (DSL) languages ​​for specific areas are already migrating to these technologies. Goldman Sachs is working with the Graal community to migrate their DSL to Graal. In addition, Ruby / OMR, Python / Graal, JS / Graal, WASM / Graal and other projects that really link different language ecology are also rapidly developing.

Back to AJDK, Graal has been supported in AJDK 8, and mature technologies such as JS / Graal have been launched in Ali's internal business.

At last

Java is a technology that was invented more than 20 years ago. She has experienced hardships and changed its master several times, but it has lasted for a long time. This report aims to sort out the current status of Java technology for Java developers and discuss the evolution of Java technology in these important areas such as cloud and AI. In the relevant part of the introduction, we also interspersed some of Ali's engineering practices. As one of the largest Java users in the world, we have also been exploring cutting-edge Java technologies, and through the experiments in Ali's rich business scenarios, we really apply these technologies to real production environments. We are also very happy to share and contribute the experience, practice and technical insights in the field of Java to jointly promote the development of Java.

reference

[1]https://www.infoq.com/news/2017/10/javaone-opening/
[2]https://www.oracle.com/technetwork/java/javase/11-relnote-issues-5012449.html#Diffs
[3]https://openjdk.java.net/jeps/377
[4]https://mp.weixin.qq.com/s/FQpvT5wIy9xwhX2jHMU7aw
[5]https://mp.weixin.qq.com/s/K1us6aH-gjHsWGhQ3SulFg
[6]https://www.infoq.cn/article/uzHpEbpMwiYd85jYslka

Published 381 original articles · praised 1240 · 810,000 views

Guess you like

Origin blog.csdn.net/alitech2017/article/details/105683535