On 05/09/2023 22:02, Christopher Schultz wrote:
Mark,
On 9/5/23 15:55, Mark Thomas wrote:
On 05/09/2023 20:38, Christopher Schultz wrote:
All,
I have some questions about Virtual Threads and their use within
Tomcat. Note that only Tomcat 11 currently has support for Virtual
Threads when running on a version 19 or later JVM.
Not quite. All current versions support virtual threads when running
on Java 21 or later.
Thanks for the correction. I just did a quick docs[1] search for
"virtual" in Tomcat 10.x for example and I didn't see useVirtualThreads,
so I assumed it wasn't in there. Maybe we need some documentation
back-ports?
Odd. It is there as an attribute on the Connector. And in 9.0.x and
8.5.x too.
The virtual thread scheduler uses a work stealing queue so it isn't
quite FIFO.
That sounds like nit-picking to me.
It is, but it is nit-picking for a reason. Violetta did some testing
which showed switching to virtual threads showed a small (about 1%)
throughput improvement it also showed a much broader spread of
latencies. That increase in spread is due to the work-stealing queue.
For those users watch latency carefully, the change was viewed as a
significant drawback of switching to virtual threads.
<snip/>
I think you have summed things up pretty well. I don't see a way with
the current API to specify multiple virtual thread schedulers (which
is what I think you would need to address this).
Yeah, in all of the coverage I've seen online, there are no examples
where Virtual Threads are used with an "executor" other than one that
(a) accepts Runnable tasks and (b) just generates a Virtual Thread from
that task which appears to be "bound" to the build-in default JVM-wide
Virtual Thread executor.
It would be potentially interesting to see an API which would allow
different Executors to be used with Virtual Threads, even though the
whole point of the entire thing is to avoid the (application-level)
complexity of a thread pool/executor/etc. I think it does make sense,
however, to be able to prioritize your threads a little bit. I haven't
read anything about Virtual Threads and their priorities, so I assume
it's just not part of anything user-facing at this point.
I haven't seen anything that suggests that there will be any such API
but to be fair, I haven't been following the Loom project that closely.
For those of you that are finding this topic interesting, I'll have a
talk on this at the ASF conference, Community Over Code in Halifax.
https://communityovercode.org/schedule-list/#TH001
More broadly, there are usually a reasonable number of Tomcat committers
present at ASF conferences so this is a great opportunity to speak face
to face with the committers.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org