Recommendation for SPDY usage of zlib

141 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Brian Olson

chưa đọc,
16:07:20 2 thg 2, 20102/2/10
đến spdy...@googlegroups.com
I did some testing of various configurations of zlib on some HTTP header data and have some recommendations. There is a tradeoff to be made between memory and speed and compressed data size, but I think there appear to be some pretty good settings we should use for our purposes that are different than the zlib default settings. The default compressor context is about 256 KB but a 20KB context can do nearly as well.

  • use at least deflateInit2(, /*level*/ 9, Z_DEFLATED, /*windowBits*/ 11, /*memLevel*/ 1, Z_DEFAULT_STRATEGY)
    • the initial 'level' parameter should always be 9.
    • less than windowBits=11, memLevel=1 produces negligible compression
    • larger window is useful to get better compression
    • larger memory mode appears relatively less useful
    • Z_DEFAULT_STRATEGY looks like the best default
  • SPDY implementations should allow for zlib initialization parameters to be customized
    • This is an implementing library API issue and does not affect the SPDY proctocol.
  • SPDY implementations should default to windowBits=11,memLevel=1 or windowBits=12,memLevel=1 so that servers with many active connections don't suffer too much from zlib context memory size per connection
    • Client implementations with relatively fewer active connections may wish to go with higher cost zlib contexts, possibly the default 15,8 , so as to get the best compression across likely slow outbound connections. This increases the decompression context on the server but only up to a maximum of about 40KB.

Data tables built by my test program attached.
zlib_20100202.html
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới