Bogdan Ciprian Pistol a écrit :
Hello all,
A discussion on the https://issues.apache.org/jira/browse/DIRMINA-751
arose that is more appropriate here on the ML.
Emmanuel Lecharny said:
"Some thoughts :
- in MINA 3.0, the IoBuffer class will probably be removed, or
refactored, as we don't really need all this mechanism, but this is
more something we should discuss on the ML.
- the class hierarchy is probably overkilling. We should have a
IoBuffer interface, an AbstractIoBuffer abstract class, move the
IoBufferWrapper and ProxyHandshakeIoBuffer classes to be subclasses of
the AbstractIoBuffer class.
- I'm not convinced that using the CachedBuffer brings any speed
improvement. Trying to be smarter than the VM is most certainly a lost
of time... IMO, this class should be removed. "
I understand the performance of the new IoBuffer 3.0 that will have a
list of ByteBuffers
(http://cwiki.apache.org/confluence/display/MINA/MINA+3.0+design) so
will provide a continuous stream of bytes that spans several
ByteBuffers (zero copy on auto-resize, just add a one more ByteBuffer
to the list in the IoBuffer), but when writing the list of ByteBuffers
out on the network, how do you want to do it? I understand that the
gathered write has some problems in JDK, I heard some rumors about
this, for example:
http://lists.jboss.org/pipermail/netty-users/2009-July/000939.html
Though I did not tested personally if there is a problem with gathered writes.
IMO, there are two different cases. The zero copy things is really
important when transfering huge block of data, as it saves CPU cycles
(http://www.ibm.com/developerworks/library/j-zerocopy/), but if there is
any transformation (encoding, for instance), I'm not sure that it's a
real problem compared to the complexity it carries.
My personnal guess is that if someone has to implement a file transfert
server, then he should have a way to use a direct copy to he clients.
Otherwise, let's assume that a list of buffer will be more efficient
than an extented buffer which will be created and copied for every bit
of data coming in.