Hi, I am trying to experiment with Loom (https://openjdk.java.net/jeps/425) virtual threads in Tomcat 10. There is a nice extension point in server.xml where I can provide an Executor and use it in the default Connector. It works like a charm--all my requests run on a virtual thread, and AFAIK, nothing else does.

There is just one issue. It takes forever for Tomcat to execute the virtual threads. I made a timestamp for each invocation of

public void execute(Runnable command)

called from org.apache.tomcat.util.net.AbstractEndpoint.processSocket

When I fire 1000 simultaneous requests, I can see that method being invoked 1000 times, but it takes a while to work through the requests. The last invocation occurs two minutes (!) from the sending of the requests.

When using the org.apache.catalina.core.StandardThreadExecutor, that many requests are handled in 3 seconds.

Is there something that I am overlooking? I had hoped that execute would be called near-instantly 1000 times, and then the Loom virtual threads could show their mettle and execute concurrently.

Thanks,

Cay

--

Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to