Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-50383][CORE] Support Virtual Threads in REST Submission API #48923

Closed
wants to merge 1 commit into from

Conversation

dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Nov 21, 2024

What changes were proposed in this pull request?

This PR aims to support JEP-444: Virtual Threads in REST Submission API for Apache Spark 4.0.0.

Why are the changes needed?

Virtual Threads becomes an official feature in Java 21.

Virtual threads are lightweight threads that reduce the effort of writing, maintaining, and debugging high-throughput concurrent applications.

In addition, Jetty 11 supports Virtual Threads.

We had better provide a way to use it via a new option spark.master.rest.virtualThread.enabled, which is enabled in Java 21 runtime. Please note that this aims for high-throughput concurrency.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the CORE label Nov 21, 2024
@dongjoon-hyun dongjoon-hyun changed the title [SPARK-50383][CORE] Support Virtual Threads in REST Submission API [SPARK-50383][CORE] Support Virtual Threads in REST Submission API Nov 21, 2024
@dongjoon-hyun
Copy link
Member Author

Thank you, @viirya !

val newVirtualThreadPerTaskExecutor =
classOf[Executors].getMethod("newVirtualThreadPerTaskExecutor")
val service = newVirtualThreadPerTaskExecutor.invoke(null).asInstanceOf[ExecutorService]
threadPool.setVirtualThreadsExecutor(service)
Copy link
Member

Choose a reason for hiding this comment

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

The thread number configured for the threadPool also determines the number of virtual threads?

Copy link
Member

Choose a reason for hiding this comment

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

For example #48921.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, AFAIK, this is orthogonally handled in Jetty layer, @viirya .

@dongjoon-hyun
Copy link
Member Author

BTW, after merging #48921, I need to rebase this PR to resolve the conflicts.

@dongjoon-hyun
Copy link
Member Author

Rebased to master to resolve conflicts~

@dongjoon-hyun
Copy link
Member Author

Merged to master for Apache Spark 4.0.0.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-50383 branch November 22, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants