feat(native): Experimental GraalVM Native Image Support 🚀#2382
feat(native): Experimental GraalVM Native Image Support 🚀#2382TartanLeGrand wants to merge 3 commits intojitsi:masterfrom
Conversation
This commit introduces support for building Jitsi Videobridge as a GraalVM Native Image. Changes: - Added Dockerfile.native for multi-stage native build. - Added Dockerfile.agent for easy configuration capture. - Added GraalVM configuration in config-full/ (including reflection for Jersey, Jackson, and Colibri v2). - Updated pom.xml to fix shading for native builds. - Updated Application.java to register JacksonFeature. - Added load-test.js and load-test-conferences.js for benchmarking. - Added BENCHMARK.md detailing performance improvements (17x startup, 23x CPU reduction). This is a Proof of Concept (PoC) validation.
|
Hi, thanks for your contribution! |
|
This is interesting, I would definitely like to understand it better. The workload for the test is not very representative. In real world conditions most of the CPU time and memory is used for routing media, and I suspect there's much less opportunity for optimization there. Would you be able to test performance with actual media routing? |
I assume yes, although I’m still fairly new to Jitsi. There is jitsi-hammer but is outdated: Otherwise, from what I understand, it’s also possible to use jitsi-meet-torture with a Selenium Grid, combined with the loadtest client, to generate more realistic media-routing workloads. |
- Add proxy-config.json for HK2 dynamic proxy registration - Add reflect-config.json for Jersey internal class reflection - Add ServicesResourceTransformer to maven-shade-plugin for META-INF/services merging This fixes IllegalStateException errors when running JVB as a native image with Jersey REST endpoints.
|
@bgrozev following your feedback, I've been able to run a more comprehensive test. Here's a summary of the work done: 🔧 Additional Fixes AppliedThe initial PoC had Jersey/HK2 dependency injection issues when running under GraalVM. I've added the following fixes: 1. GraalVM Configuration Files:
2. Maven Shade Plugin Fix:
✅ Media Routing ValidationI successfully ran Test Environment:
Results during 50 concurrent browser sessions:
The native JVB handled real browser-based WebRTC connections with minimal resource increase! 🚀
|
|
Thank you for doing additional tests! Frankly, the results don't seem realistic. Can you monitor metrics (:8080/metrics) while the test is running to confirm that media is flowing? |
This PR introduces experimental support for building Jitsi Videobridge (JVB) as a GraalVM Native Image. The goal is to explore significant performance optimizations in terms of startup time, memory footprint, and CPU efficiency, making JVB more suitable for auto-scaling and serverless environments.
This is a Proof of Concept (PoC).
While the results are promising, I have not tested all endpoints and features.
/about/health,/about/version, and/colibri/v2/conferences(conference creation).This contribution is intended as a starting point for the community to test and improve upon.
📊 Benchmark Results (Comparison)
We performed a stress test using k6 (50 concurrent users/sec creating conferences).
🛠️ Changes
config-full/containing the generated reflection metadata.JacksonFeaturefor JSON support in native mode.🏃 How to Test
docker build -f Dockerfile.native -t jvb-native .🔮 Future Vision & Applicability
This PR serves as a proposal to modernize the Jitsi Java stack. While this implementation focuses on JVB, the same GraalVM Native Image approach is applicable to other Jitsi components (like Jicofo).
Adopting this across the ecosystem could lead to:
This work is open for discussion and refinement! 🤝