Guus der Kinderen created DIRMINA-1078:
------------------------------------------

             Summary: OrderedThreadPoolExecutor should allow sessions to be 
prioritized
                 Key: DIRMINA-1078
                 URL: https://issues.apache.org/jira/browse/DIRMINA-1078
             Project: MINA
          Issue Type: New Feature
          Components: Core
            Reporter: Guus der Kinderen


The functionality provided in {{OrderedThreadPoolExecutor}} should be augmented 
to, optionally, allow for assignment of priority to certain sessions over 
others.

We've introduced this functionality after observing issues in a deployment 
where system resources where being starved by the sheer amount of sessions that 
attempted to perform TLS. Without the class introduced by this commit, events 
for any session could eventually fail (time-out), causing the session to fail. 
If that session happened to be a session that had already established TLS, the 
resources that were spent on establishing TLS are wasted. The negative effect 
is amplified by the fact that a typical client in such a situation would attempt
 to reconnect, which further adds to the load of the system already being 
starved.

With the modifications introduced by the patch provided in this issue, priority 
can be given to sessions that have already established TLS. This dramatically 
reduces the issue described above, as the first sessions to fail will be those 
that are still negotiating TLS. Using a specialized {{Comparator}}, one can 
even prioritize between these, causing sessions for which least effort has 
performed to fail before sessions that are more likely to near TLS completion.

The patch intends to add this feature as optional functionality to the existing 
implementation, with little side effects to the existing, default behavior.

The implementation provided here was initially based on a copy of the 
implementation of {{OrderedThreadPoolExecutor}} that introduced a considerable 
amount of code duplication. For illustrative purposes, the line of commits 
leading from that initial commit to the patch attached to this JIRA issue can 
be found at 
[https://github.com/guusdk/mina/commit/c0a421cf445696fbfd4d5b10d650d7c71d8faab7]
 and later commits.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to