Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-9028

CXF produces thread pinning when using virtual threads

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None
    • Unknown

    Description

      When using virtual threads, it's important to avoid the use of synchronized objects and methods because I/O operations executed in them will pin the virtual thread to its carrier thread, blocking the carrier thread instead of the virtual one.

      Executing some tests with a CXF client in a Tomcat server using virtual threads I see that, if I spawn a few tens of virtual threads I get a lot of thread pinning due to the code in 

       

      PhaseInterceptorChain

       

      In this class, there's a method that's invoked for all requests 

       

      public synchronized boolean doIntercept(Message message)

       

      This method pins the virtual thread to the carrier thread for all the duration of the request and response, which might be a lot of time and it hinders the multithreaded applications throughput. Just changing the use of synchronized keywords for ReentrantLocks will solve this issue.

       

       

      Attachments

        1. image-2024-06-11-13-14-36-151.png
          347 kB
          Jose Antonio
        2. image-2024-06-11-13-15-39-139.png
          303 kB
          Jose Antonio

        Activity

          People

            Unassigned Unassigned
            getaceres Jose Antonio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: