Encoder for binary protocol

netty20101117 david90900 at mailinator.com
Wed Nov 17 11:53:41 EST 2010


Hi,
I am implementing a binary protocol with an 8 byte header, following by a
message body.
Message length is total length of message


            0              1              2              3
     +--------------+--------------+--------------+--------------+
     |Version       |    Op Code   |       Client-info           |
     +--------------+--------------+--------------+--------------+
     |                      Message Length                       |
     +--------------+--------------+--------------+--------------+

Header is 8 bytes

Version: 8 bits
Op Code: 8 bits
Client-info: 16 bits
Message Length: 32 bits

Opcode encoded as follows
1 = Request        (REQ)
2 = Response       (RES)
3 = Client-Open    (OPN)
4 = Client-Accept  (CAT)
5 = Client-Close   (CC)
6 = Keep-Alive     (KA)

For the encoder i extend OneToOneEncoder

For the decoder I extend FrameDecoder. At the moment I am only able to
achieve a message rate of around 600-700 msgs per second. To increase
performance
would it be better to extend ReplayingDecoder instead ? Typically received
messages are between 120 & 200 bytes in length

Any help appreciated
Thanks
David
-- 
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Encoder-for-binary-protocol-tp5332889p5748507.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list