Skip to content

[KYUUBI #7655][SERVER] Support virtual threads in the binary frontend - #7656

Open
wangzhigang1999 wants to merge 2 commits into
apache:masterfrom
wangzhigang1999:kyuubi-server-virtual-thread-frontend
Open

[KYUUBI #7655][SERVER] Support virtual threads in the binary frontend#7656
wangzhigang1999 wants to merge 2 commits into
apache:masterfrom
wangzhigang1999:kyuubi-server-virtual-thread-frontend

Conversation

@wangzhigang1999

Copy link
Copy Markdown
Contributor

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?

  • Targeted suites passed on JDK 11 and JDK 21.
  • dev/reformat
  • git diff --check
  • Kyuubi Server fast package build.
  • Five-minute A/B test with real Spark SQL.

Was this patch assisted by generative AI tooling?

Assisted-by: OpenAI Codex (GPT-5)

@github-actions github-actions Bot added kind:documentation Documentation is a feature! module:common labels Aug 24, 2026
Comment thread kyuubi-common/src/main/scala/org/apache/kyuubi/config/KyuubiConf.scala Outdated
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 " +

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember we have lots of synchronized in the codebase, and will it cause issues on JDK 21?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can benchmark with JDK 25 #7657

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll give it a try.

…nf.scala

Co-authored-by: Cheng Pan <pan3793@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:documentation Documentation is a feature! module:common

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants