REMOTE JITSERVER TECHNOLOGY

Gokhan Karadas
Trendyol Tech
Published in
4 min readApr 20, 2020

JIT COMPILER

The (JIT) compiler is a component of the runtime environment that improves the performance of Java applications by compiling bytecodes to native machine code at run time.

Java programs consist of classes, which contain platform-neutral bytecodes that can be interpreted by a JVM on many different computer architectures. At run time, the JVM loads the class files determine the semantics of each individual bytecode, metadata processing, and profiling, another processing. The additional processor and memory usage during interpretation mean that a Java application performs more slowly than a native application. You can find more detail about JIT process.

JIT SERVER TECHNOLOGY PREVIEW

JIT server technology decouples the JIT compiler from the VM. JIT runs own process remotely. This provides us with low memory and low CPU spiky when the application startup. The process can run either locally or on a remote machine.

Recommendation way to use this technology

  • Your Java application is required to compile many methods using JIT in a relatively short time.
  • The application is running in an environment with limited CPU or memory.

Traditional JIT Arch

REMOTE JIT SERVER

How does it works?

When the client VM wants to compile a method, it sends a request to the server. Server compiles it, and sends compiled code back to the client. Once the client receives the compiled code, it relocates and installs it in the code cache.

The main benefits: smaller memory footprint and CPU consumption on the client, without sacrificing throughput for small docker environment.

Reference:https://blog.openj9.org/2019/05/01/openj9-internship-making-jit-a-cloud-service/

SETUP REMOTE JIT SERVER

It’s currently available for OpenJDK 8 and OpenJDK 11 running on Linux on x86–64.

Run OpenJ9 in server mode

It listens for incoming compilation requests default port 38400.

FROM  adoptopenjdk/openjdk11-openj9
ENTRYPOINT jitserver -Xjit:verbose

Run OpenJ9 JITSERVER in client mode

Virtual Machine sends compilation requests to an available JITServer. If no available JITSERVER it automatically uses local jit.

java  -jar -XX:+UseJITServer -XX:JITServerAddress="172.17.0.2"

When the application started there is no CPU and memory spiky. Because all processes handled with remote JITSEREVER.

You can see remote server Jit verbose log

In this case, the remote jit server started before our application. After that, we started our application. You can see that our application CPU consumption is %1 CPU. Source Code

--

--