graal icon indicating copy to clipboard operation
graal copied to clipboard

Very slow warmup with Graal Compiler JIT (in a Netty-based application)

Open guilgaly opened this issue 8 months ago • 4 comments

Describe the issue

Running the Gatling load testing tool (which relies heavily on Netty internally) on GraalVM CE, we have noticed very slow warmups compared to running with the traditionnal C2 JIT compiler (with the warmup period taking 5 times as long or more).

We also observe this with a simplified use case built directly with Netty. We are particularly interested in GraalVM because of Truffle, but our reproducer here is purely in Java.

Are these long warmup times to be expected at the moment with the Graal JIT compiler or would you consider there is something specific going on here? Are there plans for improvements? Are there tuning options we should investigate?

Steps to reproduce the issue

We have a simplified reproducer here: https://github.com/gatling/bug-report-graal-compiler-warmup

It runs a simple HTTP server and client (both based on Netty) in the same process. The client opens n connections, performs the same HTTP request over and over again on each connection, and logs the total throughput every quarter of a second.

Results of our tests can be seen here (with the data also converted to more readable graphs in the HTML files): https://github.com/gatling/bug-report-graal-compiler-warmup/tree/main/test-results/2024-06-11. They all run on the same machine, using either Azul Zulu (so with the usual C2 JIT compiler), GraalVM CE, or Oracle GraalVM. The stable throughput after the warm-up period is quite comparable, but the warm-up times are very different:

  • With Zulu, it takes about 7 seconds.
  • With GraalVM CE, it takes about 45 seconds (including more than 30 seconds to reach just half of the final througput).
  • With Oracle GraalVM, it takes about 25 seconds (although at least we reach about 80% of the final throuput after about 12 seconds).

Describe GraalVM and your environment:

  • GraalVM version:
    • GraalVM CE: CE 22.0.1+8.1 (build 22.0.1+8-jvmci-b01)
    • Oracle GraalVM: 22.0.1+8.1 (build 22.0.1+8-jvmci-b01)
    • Azul Zulu (for reference comparison): Zulu22.30+13-CA (build 22.0.1+8)
  • JDK major version: 22
  • OS: Amazon Linux 2
  • Architecture: AMD64 (tested on an AWS EC2 C6i.2xlarge instance)

More details

Please don't hesitate to let us know if we can provide usefull additional test data, try out different tuning options, etc.

guilgaly avatar Jun 14 '24 07:06 guilgaly