Julien Vermillard a écrit :
Le lundi 17 juillet 2006 à 11:01 -0400, Alex Karasulu a écrit :
Julien Vermillard wrote:
Hi all,
Actualy it's very easy to calculate bytes thoughput (read and write) by
looking in the IoSession objects and using the following methods :
long getReadBytes()
Returns the total number of bytes which were read from this
session.
long getWrittenBytes()
Returns the total number of bytes which were written to this
session.
But for PDU encoding/decoding performance there is nothing, actualy.
I would like to add the following methods :
long getReadPDU();
long getWrittenPDU();
I'm thinking about adding them in mina.filter.codec.ProtocolCodecFilter.
The total count of encoded PDU will be done in ProtocolCodecFilter, but
for the count of decoded PDU I'm thinking about the interface
ProtocolDecoderOutput (implemented in SimpleProtocolDecoderOutput).
Hmmm so mina can make use of the protocol codec to determine when it
should increment the PDU's read and written?
Meaniing it can make the decoders and encoders tell it when the
demarcations between PDUs occurs?
Alex
Decoders call "ProtocolDecoderOutput.write(Object pdu)" each time a PDU
is decoded so MINA can increment "PDU read count" each time this method
is called (for a session)
encoders gets PDUs from ProtocolEncoder.encode(Object pdu) so MINA can
increment the "PDU write count" each time ProtocolDecoderFilter call
this method for a session.
Not sure this is easy to implement. Currently, we decode PDU "on the
fly", and it's done deep inside the Ldap decoder. This is the only place
where we "know" that a PDU has been completely decoded (because MINA
don't read the PDU length, it has no way to know if a PDU has been
totally read or not). When the PDU is decoded, we just call the callback
to handle the PDU.
Another tricky point - which is not handled currently - is that we
would like to be able to write chunks of data, to avoid MINA to keep a
load of bytes.
Fort instance, if we have a jpeg image to send, we will send it piece by
piece, so that we won't keep 1Mbyte in memory.
This makes it difficult for MINA to know when a PDU has been sent,
except if we extend MINA to add a PDUDecoded() method call to tell MINA
that a PDU has been fully decoded. Or something like that.
Emmanuel