[KYUUBI #7655][SERVER] Support virtual threads in the binary frontend - #7656
[KYUUBI #7655][SERVER] Support virtual threads in the binary frontend#7656wangzhigang1999 wants to merge 2 commits into
Conversation
| val FRONTEND_THRIFT_BINARY_VIRTUAL_THREADS_ENABLED: ConfigEntry[Boolean] = | ||
| buildConf("kyuubi.frontend.thrift.binary.virtual.threads.enabled") | ||
| .doc("Whether to use virtual threads for the Kyuubi server thrift binary frontend " + | ||
| "workers. This requires Java 21 or later. The maximum number of concurrent workers " + |
There was a problem hiding this comment.
I remember we have lots of synchronized in the codebase, and will it cause issues on JDK 21?
There was a problem hiding this comment.
Yes, I also tried a more aggressive version that converted the entire SQL pipeline—including the Spark SQL engine—to virtual threads.
At that time, I found that synchronous Log4j output caused pinning, which even led to hangs under the default carrier thread count. Therefore, I significantly narrowed the scope of the first PR.
Your reminder is crucial. If you also agree that we can introduce virtual threads, I will conduct benchmarks on larger-scale real-world datasets, which would make the case more compelling.If necessary, some synchronized blocks can also be optimized.
There was a problem hiding this comment.
I’ll give it a try.
…nf.scala Co-authored-by: Cheng Pan <pan3793@gmail.com>
Why are the changes needed?
Virtual threads are mature in JDK 21, which Kyuubi already supports. As an I/O-bound gateway, Kyuubi is a good fit for this execution model.
This PR makes a small first step by adding optional virtual-thread support to the server-side Thrift Binary frontend. It is disabled by default and does not affect engine frontends or other executors.
The implementation preserves the worker concurrency limit and rejection behavior while retaining compatibility with older JDKs.
See #7655 for the motivation and benchmark results.
How was this patch tested?
dev/reformatgit diff --checkWas this patch assisted by generative AI tooling?
Assisted-by: OpenAI Codex (GPT-5)