[JBoss JIRA] Created: (NETTY-203) Encoding frames as Google Protocol Buffer base 128 varints (32-bit).

Tomasz Blachowicz (JIRA) jira-events at lists.jboss.org
Fri Jul 24 10:53:29 EDT 2009


Encoding frames as Google Protocol Buffer base 128 varints (32-bit).
--------------------------------------------------------------------

                 Key: NETTY-203
                 URL: https://jira.jboss.org/jira/browse/NETTY-203
             Project: Netty
          Issue Type: Patch
            Reporter: Tomasz Blachowicz
            Assignee: Trustin Lee
            Priority: Optional
         Attachments: varint32.patch

Currently each frame is prepended with fixed size four byte integer value that is a length of the message. Why not to use cool protobuf varint (http://code.google.com/apis/protocolbuffers/docs/encoding.html#varints) for that purpose? By doing this for small messages one could save a few bits of bandwidth. For instance, messages smaller that 128 bytes can be "framed" only by one byte representing the size.

Detailed discussion can be found here:
http://n2.nabble.com/Google-Protocol-Buffers-integration-is-readyef685743.-tp2122078.html

The patch contains two new classes (field prepender and frame decoder):
* org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FieldPrepender - An encoder that prepends the length of the message.  The length value is prepended as a binary form. encoded as Google Protocol Buffer Base 128 Varints (32-bit).
* org.jboss.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder - A decoder that splits the received ChannelBuffers dynamically by the value of the length field in the message. ProtobufVarint32FrameDecoder should be used to decode a binary message which has an integer header field encoded as Google Protocol Buffer Base 128 Varints</a> (32-bit) integer that represents the length of the message body.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the netty-dev mailing list