130 questions
1
vote
1
answer
56
views
Virtual Threads in Spring Integration for long-running external service calls
We are currently working on a Spring Integration flow where each incoming message needs to trigger a call to an external HTTP service. The external call can take up to 20 seconds to complete, and the ...
6
votes
2
answers
165
views
Using ScopedValue instead of ThreadLocal in Servlet Filter in spring boot app
Our application heavily uses ThreadLocals where we read values from ServletRequest parameters and provide theses as a global context on Thread Level to other Services.
Something like this:
@Component
@...
0
votes
1
answer
52
views
How to specify the thread model of a vert.x verticle as virtual threads in the command line?
I am using vert.x version 4.5.13
I expect to use Vert.x's Launcher to start the verticle. When deploying the Verticle programmatically, I know that I can set the virtual thread as the underlying ...
1
vote
1
answer
90
views
How to properly use SimpleAsyncTaskExecutor when its needed to wait for all virtual threads to finish?
How to properly use SimpleAsyncTaskExecutor when its needed to wait for all virtual threads to finish?
Description
I have a Scheduled code that runs every night.
This code, makes a bunch of queries to ...
1
vote
0
answers
47
views
Nonblocking jooq queries with Kotlin
I've found conflicting advice regarding how best to make non-blocking queries in Kotlin. What is the best practice today; to use R2DBC, virtual threads with coroutines, or plain coroutines? A simple ...
5
votes
2
answers
512
views
Spring boot with java 21 virtual threads - is there a way to terminate gracefully?
In SB 3.4 + java 21, when you terminate the java process, regardless of type of task executor, it will wait till all threads finish, which will include scheduled jobs as well as API calls.
However, if ...
0
votes
0
answers
26
views
Regarding the problem of virtual thread suspension
I invoked the code logic for querying the database within a Verticle scheduled by virtual threads. The database logic part utilizes the MyBatis-Plus ORM framework. I carried out concurrent tests, yet ...
0
votes
2
answers
210
views
Multiple virtual threads on a single platform thread
When using virtual threads in Java 21 there is a way to limit the number of underlying platform threads by specifying jdk.virtualThreadScheduler.parallelism and jdk.virtualThreadScheduler.maxPoolSize ...
5
votes
1
answer
343
views
Using toFuture in Spring webClient when using virtual threads
I've been trying to implement an orchestration system using VirtualThreads.
So far, I understand the underlying problems that I may face, and the one that really concerns me is "pinning."
I'...
0
votes
0
answers
68
views
Undertow stopped response when using virtual thread in Springboot3.4.1
Environment:
2vCpu, 8G RAM
centos8, Jdk 21.0.5
a springboot3.4.1 project using undertow with virtual thread, only a simple restcontroller in the project. modify the log level of undertow and xnio to ...
3
votes
1
answer
570
views
Virtual Threads Performance Degradation when running a mixture of CPU-intensive and blocking task
I am using Spring Boot 3.4.0 (JDK21) with embedded Tomcat.
I was testing the functionality of virtual threads, with one of the tests being:
@GetMapping("/test")
public void mostIOLowCPU()...
1
vote
1
answer
170
views
micrometer Instrumentation of Thread Switching Components for Executors.newVirtualThreadPerTaskExecutor() with for loop
I have the following piece of code:
@PostMapping("/question")
public String question(@RequestBody List<String> messages) {
try (ExecutorService executor = Executors....
3
votes
1
answer
795
views
How do I verify that Virtual Threads are being used in my Spring Boot microservice?
Libraries used by my microservice, running on JDK 21
Spring Boot 3.4.1
Spring Cloud 2024.0.0
Spring Cloud AWS 3.3.0-RC1
I have set spring.threads.virtual.enabled=true in my Spring Boot microservice, ...
2
votes
1
answer
289
views
Can't reproduce virtual thread pinning (jdk 21), yet mysql not as parallel as should be
The jdk 21 doc about virtual threads (hereafter "VT")
(https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html)
is pretty clear about a synchronized block causing a thread to be ...
4
votes
1
answer
381
views
Can Virtual Threads improve querying a database in Java?
I wanted to try power of virtual threads in Java in a simple application which consists of many tasks. Each task executes a query agains a database which takes around 10 seconds.
My expectation was ...