Protocol compression

Harco de Hilster harcoh "at" caos.kun.nl
Thu, 12 Mar 1998 14:58:19 +0000


Hi,

I was rather curious if general compression would improve the performance of
Xvnc, so I added zlib compression to the server and java client.
The initial results show that general compression can decrease the required
bandwidth.

Zlib is a general purpose compression library used by gzip, png and lbx. It is available
for unix, dos/win and part of the JDK 1.1, and with a non-restricting copyright.

My implementation may not be optimal, because I added the compression in
socket.c/WriteExact and sync flush the compression buffer afterwards.
As a test I ran x11perf, and compared the results with raw, rre, core and hextile encodings.

x11perf -repeat 1 -time 1 -range rect1,bigsrect500

The achieved compression ratios, actual number of bytes send:

hextile   7.987284    268725
corre     9.261887    461645
rre      11.370915    538029
raw     112.878076    283053

The actual implementation will require an additional message (compression yes/no, compression level) I think,
and perhaps some minor code rewriting to optimize the compression.

Let me know if you are interested.

Regards,

Harco


Full statistics:

rfbProcessClientProtocolVersion: client protocol version 3.3 (server 3.3)
using client's preferred encoding: hextile
Client Pixel Format:
8 bits per pixel.
True colour: max red 7 green 7 blue 3
            shift red 0 green 3 blue 6
no translation needed
rfbProcessClientNormalMessage: client gone
Statistics
----------
Key events received 0, pointer events 1
Framebuffer updates 60, rectangles 6101, bytes 2146383
   hextile rectangles 6101, bytes 2146383
Raw bytes equivalent 19531070, compression ratio 9.099527
Total bytes 2146383, total zbytes 268725, compression ratio 7.987284

rfbProcessClientProtocolVersion: client protocol version 3.3 (server 3.3)
using client's preferred encoding: CoRRE
Client Pixel Format:
8 bits per pixel.
True colour: max red 7 green 7 blue 3
            shift red 0 green 3 blue 6
no translation needed
rfbProcessClientNormalMessage: client gone
Statistics
----------
Key events received 0, pointer events 1
Framebuffer updates 41, rectangles 8094, bytes 4275704
   raw rectangles 1270, bytes 2871016
   CoRRE rectangles 6824, bytes 1404688
Raw bytes equivalent 14623764, compression ratio 3.420200
Total bytes 4275704, total zbytes 461645, compression ratio 9.261887

rfbProcessClientProtocolVersion: client protocol version 3.3 (server 3.3)
using client's preferred encoding: rre
Client Pixel Format:
8 bits per pixel.
True colour: max red 7 green 7 blue 3
            shift red 0 green 3 blue 6
no translation needed
rfbProcessClientNormalMessage: client gone
Statistics
----------
Key events received 0, pointer events 1
Framebuffer updates 51, rectangles 5083, bytes 6117882
   raw rectangles 992, bytes 3822644
   RRE rectangles 4091, bytes 2295238
Raw bytes equivalent 15978790, compression ratio 2.611817
Total bytes 6117882, total zbytes 538029, compression ratio 11.370915

rfbProcessClientProtocolVersion: client protocol version 3.3 (server 3.3)
using client's preferred encoding: raw
Client Pixel Format:
8 bits per pixel.
True colour: max red 7 green 7 blue 3
            shift red 0 green 3 blue 6
no translation needed
rfbProcessClientNormalMessage: client gone
Statistics
----------
Key events received 0, pointer events 1
Framebuffer updates 108, rectangles 14397, bytes 31950478
   raw rectangles 14397, bytes 31950478
Raw bytes equivalent 31950478, compression ratio 1.000000
Total bytes 31950478, total zbytes 283053, compression ratio 112.878076

--
-----------------+----------------------+------------------------------
Harco de Hilster  CAOS/CAMM Center       Phone:  +31(0)24-3653379
Research &        University of Nijmegen Fax:    +31(0)24-3652977
      Development Toernooiveld 1         E-mail: harcoh "at" caos.kun.nl
System Management 6525 ED Nijmegen       URL:    http://www.caos.kun.nl
                  The Netherlands
-----------------+----------------------+------------------------------