franz1981 edited a comment 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, but more a randevouz point for threads handoff) 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/awaiting on `take`, 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 completions can land 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]
