Re: Naïve Tomcat experiment--does this indicate pinning?

Alan Bateman Alan.Bateman at oracle.com
Tue May 3 07:32:51 UTC 2022


On 02/05/2022 20:11, Cay Horstmann wrote:
> :
>
> Thanks, those were good tips. I was able to see the virtual threads in 
> the thread dump, and there were no messages about pinning.
>
> For some reason, Tomcat is taking its sweet time launching the virtual 
> threads. In my executor, I added the creation time as an ExtentLocal 
> and fished it out in the servlet. I also add the query time as a query 
> parameter. The difference between query time and thread creation time 
> increases steadily, so there must be some other throttling going on 
> inside Tomcat. Annoyingly, the virtual threads are quite a bit slower 
> than the org.apache.catalina.core.StandardThreadExecutor. When I 
> launch 1000 requests simultaneously, the last request gets serviced by 
> a newly created virtual thread two minutes later! With the standard 
> Tomcat thread pool, 1000 requests are handled in 4 seconds.
>
> I remember some report from way back when where someone added virtual 
> threads to Tomcat with better success. I'd love a reference to that 
> effort.

I don't know the Tomcat architecture to explain what you are seeing. It 
may lend a lot on thread locals on the assumption that the threads are 
pooled and maybe what you are seeing is caused by this rather than 
throttling. Looking at GC logs to compare the thread pool vs. thread per 
request configuration may give some clues on that.

-Alan


More information about the loom-dev mailing list