Project

General

Profile

Reducing packet payload

Mauro Carrio
Added almost 3 years ago

Hi there,

Thanks to all the community that develops Tigase products.

We needed to improve the negotiation process of the users at the authentication. We developed a new authentication method to reduce the C2S round trip messages to 2 without SSL with SM and Resume enabled. So, now we are in a average of 1.5 seconds in the auth process (talking about new connections, not resumed connections that is really fast) on a stable wifi or a good 4G network.

The thing is that in a mobile network environment with 3G or even poorer networks, the app takes too much time to connect and the user experience is not working really because the message appears on the conversation screen sometimes with a delay of more than 10 seconds.

So, I started thinking about the possibility of reducing the the in/out packets payload by replacing the most common words like: "message, presence, from, type, xmlns, body, chat, stream, auth... etc" into codes of 1 or 2 bytes.

Tigase should format the original stanza into this conversion before sending the message to the socket, and the client apps must traduce the codes once the packet arrives.

In your opinion:

Do you think this is more efficient than compressing with zlib?

How big would be the impact for the Tigase Server Core?

Which would be the steps to achieve this?

Thanks in advance!


Replies (2)

Added by Wojciech Kapcia TigaseTeam almost 3 years ago

Mauro Carrio wrote:

So, I started thinking about the possibility of reducing the the in/out packets payload by replacing the most common words like: "message, presence, from, type, xmlns, body, chat, stream, auth... etc" into codes of 1 or 2 bytes.

Tigase should format the original stanza into this conversion before sending the message to the socket, and the client apps must traduce the codes once the packet arrives.

This somewhat feels like FunXMPP modification that (supposedly) whatsapp is using.

In your opinion:

Do you think this is more efficient than compressing with zlib?

We haven't made any tests so it's hard to answer this question. However, XEP-0286: Mobile Considerations states:

While this may mitigate some of the benefits of compression by raising compression ratios, in a large, real world deployment at HipChat, network traffic was still observed to decrease by a factor of 0.58 when enabling Stream Compression (XEP-0138) [4] with ZLIB compression!

Considering XEP-0229: Stream Compression with LZW could prove even better results as LZW usually offers better compression.

How big would be the impact for the Tigase Server Core?

Which would be the steps to achieve this?

This could be approached from the ConnectionManager perspective which could translates such packets before writing to socket. This would obviously incur additional performance decrease on the server.

Added by yin shiwu almost 3 years ago

hi Mauro Carrio, Could you share the new authentication method to me? My email account is yinshiwu@gmail.com, Thanks in advance!

    (1-2/2)