Minimizing Java Thread Context Switching Overhead
        Posted  
        
            by binil
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by binil
        
        
        
        Published on 2010-05-28T05:57:39Z
        Indexed on 
            2010/05/28
            6:01 UTC
        
        
        Read the original article
        Hit count: 258
        
I have a Java application running on Sun 1.6 32-bit VM/Solaris 10 (x86)/Nahelem 8-core(2 threads per core).
A specific usecase in the application is to respond to some external message. In my performance test environment, when I prepare and send the response in the same thread that receives the external input, I get about 50 us advantage than when I hand off the message to a separate thread to send the response. I use a ThreadPoolExecutor with a SynchronousQueue to do the handoff. 
In your experience what is the acceptable delay between scheduling a task to a thread pool and it getting picked up for execution? What ideas had worked for you in the past to try improve this?
© Stack Overflow or respective owner