[
https://issues.apache.org/jira/browse/DIRMINA-1105?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jonathan Valliere resolved DIRMINA-1105.
----------------------------------------
Resolution: Won't Do
Using {{ThreadLocal}} storage then copying the decoded message again is not a
performance advantage. What if the TL storage isn't large enough to hold the
decoded message? Expanding the buffer requires copying all the data to a new
buffer... which just made the performance even worse than the TL method under
the best scenario. The minimum application buffer size may be 16k give or take
but the maximum is much larger and you don't want to end up in situations where
you have to cycle the encode or decode loop needlessly because you didn't
allocate enough memory the first time or are force to copy the buffers.
Garbage collection is a separate performance problem, that can be alleviated
using memory pools, from a solution which forces the copying data again and
again needlessly.
> SSLHandler buffer handling
> --------------------------
>
> Key: DIRMINA-1105
> URL: https://issues.apache.org/jira/browse/DIRMINA-1105
> Project: MINA
> Issue Type: Improvement
> Affects Versions: 2.0.21, 2.1.1
> Reporter: Emmanuel Lécharny
> Assignee: Emmanuel Lécharny
> Priority: Major
> Fix For: 2.2.0
>
>
> The {{SSLEngine.wrap()}} method requires the provided buffer to be 'big
> enough' to contain any kind of *SSL/TLS* message. That means 16921 bytes. The
> way it's implemented is that we allocate such a buffer every time we need to
> call the {{wrap}} method, then we copy the result into a smaller buffer that
> is injected into thee write queue.
> This is quite ineficient. It would rather be a better idea to use a Thread
> Local Storage buffer when calling the {{wrap}} method, and copy the content
> into a temporary buffer.
> Another optimization could be to concatenate the successive calls to the
> {{wrap}} method into a single buffer, that will be sent in one shot (it's
> frequent that more than one call to {{wrap}} is needed during the handshake).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]