Azul has introduced a new cloud-native compiler, Java Cloud Compiler, which offloads Java JIT compilation from local systems to elastic resources, reducing the amount of resources needed to run applications and shortening the time to peak performance.
Understanding JIT and AOT
The Java Runtime is a completely self-reliant system designed to run and improve code on a single system. The runtime works through just-in-time (JIT) compilation, using native resources that convert Java bytecode (JAR and class files) into native code to improve speed and memory. Simon Ritter, Azul’s Deputy CTO, explains this process understanding Java compilation in a blog post detailing how code improves over time. JIT compilation is transparent to most users transparently, requiring no developer or administrator interaction, but curious developers can monitor their role JITWatch with the following tools.By offloading this JIT compilation to a separate system, Azul’s cloud compiler can execute the JIT faster, share optimizations between systems running the same code, and return resources to the application to improve throughput or reduce the total CPU/RAM required and reduce costs.
Red Hat has published a blog, How the JIT Compiler Improves Performance in the OpenJDK, which covers how JIT improves Java applications as they run. This post discusses how Java applications start, monitor code, and perform optimizations to improve performance in part. These JIT optimizations are done in a self-reliant JRE that shares resources with the running application and seeks to make improvements in the application as it runs, then switches the execution to faster JIT code.
An alternative to JIT is advance (AOT) compilation, which seeks to compile Java applications directly into native code rather than through bytecode. AOT aims to reduce the time to peak performance and improve memory consumption by working ahead. A Belton article that delves into the new Java JIT compiler describes the role and differences between the standard OpenJDK JIT compiler C1/C2 and the GraalVM AOT compiler. neither JIT nor AOT is inherently better-although AOT can often be started faster, the “ahead of time " term ignores what can be learned from observing what parts of the code run, as well as the fact that AOT compilation takes significantly longer rather than bytecode, and includes other behavioral tradeoffs.
Azul Smart Cloud introduces a third option that connects the benefits of JIT (peak performance) with the benefits of AOT (fast startup time). Since teams typically run the same code across many systems, the JRE communicates with the organization’s shared JIT server, so each JRE does not need to perform the same watch and optimization cycles. The cloud compiler can then also perform deeper analysis using CPU resources that are isolated from the running application. The resulting application can achieve peak performance in the network time required to transfer this information and run with the improved code. In the tests described by QCon, peak performance was reached in a much faster time and throughput was 25% to 100% faster.
Azul’s Cloud Compiler is available in the commercial Azul Prime distribution. The free version of Prime is available for development, testing and evaluation.