Java Virtual Threads

preview_player
Показать описание
Concurrent applications, those serving multiple independent application actions simultaneously, are the bread and butter of Java server-side programming. The thread has been Java’s primary unit of concurrency since its inception and is core to the entire Java platform. However, it can no longer efficiently represent a domain unit of concurrency. As a result, Java has seen a proliferation of libraries and frameworks that offer scalability while abandoning the thread as the unit of software concurrency—and, with it, the support of Java’s observability tooling. In this session, learn how Project Loom aims to reinstate the thread as an efficient unit of concurrency by adding a lightweight implementation of threads to the Java platform.

An Oracle DevLive Level Up - Java Developer Day session.
Presented by Sergey Kuksenko, Principal Member of Technical Staff

Tags: #Java #OpenJDK #JDK20 #concurrency
Рекомендации по теме
Комментарии
Автор

01:10 Now it's possible to have millions of Java processes running concurrently.
04:28 Traditional threads are expensive, the solution could be asynchronous programming, but asynchronous programming has very intrusive downsides.
06:35 Project Loom tries to make Threads cheaper.
06:38 What is a Virtual Thread? Conclusion: they feel like normal Threads, it allows you not to care about the details underneath.
07:38 We call traditional Threads, Platform Threads.
08:39 Virtual Thread builder example and example.
09:26 Virtual Threads x Platform Threads x Sequential Benchmark.
12:15 Real Application Benchmark data. The higher the bar, the better the framework scores.
15:35 Little's Law, it works for stable systems, not for systems which continually grow. An example on how Thread-per-Request was their bottleneck in an application.
18:26 Little's Law Chart, Platform Threads x Virtual Threads throughput.
19:39 How to adopt Virtual Threads. Write synchronous code inside the task, as boring and as straightforward possible.
21:02 You should NOT pool Virtual Threads. If you need to pool, or rather limit async execution, use the Semaphore class.
22:10 Don't cache in ThreadLocals. Instead use Scoped Values.
24:10 Avoid pinning.
28:24 (end) How to adopt Virtual Threads frame.
28:54 Structured Concurrency, short intro.

kevindurant
Автор

Very informative and detailed! This talk can serve as a good summary as to why/when you should use VT.

oneextrabit
Автор

Will be great when we can write performant concurrent code with this. Had to debug some Spring Webflux / Reactive stuff lately and it was not easy.

prunge
Автор

Will you introduce API to offer control over which executor a virtual thread should run on?

juliandurchholz
Автор

Another language mojo is coming in the AI machine learning space, valhalla should come early or some struct like construct along with vector APIs otherwise java could never take off for AI/Machine learning space.

dumdumdumdum
visit shbcf.ru