Packet compression benchmark

Guus Sliepen
Mon, 11 May 2015 08:00:43 -0000

On Sun, May 10, 2015 at 08:16:54PM -0400, Darik Horn wrote:

> > LZ4 is supposed
> > to be a very fast compression algorithm, especially when it comes to
> > decompression. I did a quick benchmark with zlib, LZO and LZ4. Now,
> > there are many benchmarks you can find online, but most of them deal
> > with compressing large files. Tinc on the other hand has to compress
> > small packets individually
>
> The proposed 1.1-LZ4 branch implements block mode.  Given that you are
> familiar with the code, is there a way to guarantee packet ordering at
> the decompressor so that stream mode can also be implemented?

Yes, with TCPOnly. But then additional code would be required to
compress the stream going via TCP. The main drawback of TCPOnly is that
it lowers the performance of the VPN. It might very well be that this
negates any advantage of compression.

> Even in block mode, I got the usual tradeoff for non-pathological
> data:  LZ4 produces a slightly larger image for much less CPU time
> than LZO.

Please note that since LZ4 has a worse compression ratio than LZO and
zlib, the only advantage would be its use when you are not
bandwidth-limited. So the real benchmark for LZ4 is what transfer speed
you get when the sender side is using 100% of its CPU.

> I'm working on getting LZ4 baked into an OpenWRT build for further
> testing, which is the kind of embedded system where Tinc really
> shines.

It would indeed be very nice to see how the compression algorithms
perform on an embedded device.

--
Met vriendelijke groet / with kind regards,
     Guus Sliepen <guus at tinc-vpn.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL:
<http://www.tinc-vpn.org/pipermail/tinc-devel/attachments/20150511/39b2abf2/attachment.sig>