franz1981 commented on pull request #44:
URL: https://github.com/apache/qpid-jms/pull/44#issuecomment-953645864


   > I dont believe it will ever work the way you want with a simple queue of 
any size. You have to add hoops to manipulate it into behaving that way
   
   A synchrnous queue (that's not a real queue, actually) works exactly like 
that, but I've made a mistake about how completions are submitted...doc says
   ```
   Direct handoffs. A good default choice for a work queue is a 
SynchronousQueue that hands off tasks to threads without otherwise holding 
them. Here, an attempt to queue a task will fail if no threads are immediately 
available to run it, so a new thread will be constructed. 
   ```
   Let me think about it a bit more and I see if this PR can be closed or just 
need to be refined to achieve the expected behaviour
   
   >but I've made a mistake about how completions are submitted
   
   It means that if the Netty event loop the connection belong is going to 
submit completions for 2 different sessions (eg let's say 1 and 2) and session 
1 is already processing completions:
   - incoming completions vs session 1 should add them to the session 
completion queue without bothering the thread pool, because there's already a 
running completion thread handling them
   - new session 2 completions won't find any completion thread awake and would 
submit the request to the thread pool
   - the synchronous queue is built to reject any offer if there is no thread 
idle, that means that the thread pool create a new one to handle session 2 
completions or reuse any existing one (without rejecting the task offer)
   
   It means that under heavy load completion arrives so fast that we still have 
2 separate threads handling the 2 sessions completion, that's not exactly what 
I want
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to