Hi community,

I am working on a Spring Boot + Tomcat embedded application using
Virtual Threads (https://openjdk.org/jeps/425), and everything looks
great until we activate HTTP2. We started to see the following logs:

Thread[#72,ForkJoinPool-1-worker-9,5,CarrierThreads]
    org.apache.coyote.http2.StreamProcessor.process(StreamProcessor.java:86)
<== monitors:1
Thread[#70,ForkJoinPool-1-worker-7,5,CarrierThreads]
    
org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper$NioOperationState.run(NioEndpoint.java:1609)
<== monitors:1
Thread[#41,ForkJoinPool-1-worker-4,5,CarrierThreads]
    
org.apache.coyote.http2.Http2AsyncUpgradeHandler.writeHeaders(Http2AsyncUpgradeHandler.java:199)
<== monitors:1
    org.apache.coyote.http2.StreamProcessor.process(StreamProcessor.java:86)
<== monitors:1
Thread[#40,ForkJoinPool-1-worker-3,5,CarrierThreads]
    org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:1000)
<== monitors:1
    org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:940)
<== monitors:1
Thread[#61,ForkJoinPool-1-worker-6,5,CarrierThreads]

Thread[#72,ForkJoinPool-1-worker-9,5,CarrierThreads]
    org.apache.coyote.http2.StreamProcessor.process(StreamProcessor.java:86)
<== monitors:1
Thread[#70,ForkJoinPool-1-worker-7,5,CarrierThreads]
    
org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper$NioOperationState.run(NioEndpoint.java:1609)
<== monitors:1
Thread[#41,ForkJoinPool-1-worker-4,5,CarrierThreads]
    
org.apache.coyote.http2.Http2AsyncUpgradeHandler.writeHeaders(Http2AsyncUpgradeHandler.java:199)
<== monitors:1
    org.apache.coyote.http2.StreamProcessor.process(StreamProcessor.java:86)
<== monitors:1
Thread[#40,ForkJoinPool-1-worker-3,5,CarrierThreads]
    org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:1000)
<== monitors:1
    org.apache.coyote.http2.Stream$StreamOutputBuffer.flush(Stream.java:940)
<== monitors:1
Thread[#61,ForkJoinPool-1-worker-6,5,CarrierThreads]

Inspecting the org.apache.coyote.http2.Stream class, we found several
synchronized keywords
(https://github.com/apache/tomcat/blob/main/java/org/apache/coyote/http2/Stream.java#L230).
>From the JEP, this keyword will pin platform threads and might reduce
the general throughput of the application.

I am aware Tomcat community did a great effort to move Tomat to
Virtual Threads friendly, but I am not sure why HTTP2 was not part of
that effort?

-- 
Daniel

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

Reply via email to