Skip to content

zlib: use Z_DEFAULT_STRATEGY by default instead of Z_FIXED#10676

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
rojkov:fix-zlib-strategy
Apr 8, 2020
Merged

zlib: use Z_DEFAULT_STRATEGY by default instead of Z_FIXED#10676
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
rojkov:fix-zlib-strategy

Conversation

@rojkov
Copy link
Member

@rojkov rojkov commented Apr 7, 2020

Description:

Since Envoy::Compressor::ZlibCompressorImpl::CompressionStrategy is simply static_cast'ed to uint64_t the Standard strategy (4) becomes Z_FIXED (4 as well). This basically disables the use of
dynamic Huffman codes when the gzip filter is configured to use default values.

Make the Standard strategy equal to 0 to translate to Z_DEFAULT_STRATEGY.

Contributes to #8448
Risk Level: Low
Testing: Manual testing

Since Envoy::Compressor::ZlibCompressorImpl::CompressionStrategy is
simply static_cast'ed to uint64_t the Standard strategy (4)
becomes Z_FIXED (4 as well). This basically disables the use of
dynamic Huffman codes when the gzip filter is configured to use
default values.

Make the Standard strategy equal to 0 to translate to
Z_DEFAULT_STRATEGY.

Contributes to envoyproxy#8448

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
@rojkov
Copy link
Member Author

rojkov commented Apr 7, 2020

/cc @rgs1

@rgs1
Copy link
Member

rgs1 commented Apr 7, 2020

Nice, this doesn't make my benchmarks go faster but it does compress a bit better.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, small comment.

/wait

Huffman = 2,
Rle = 3,
Standard = 4,
Standard = 0,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment on why this is done this way. Also, does this need a release note?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put the defines from zlib.h instead of magic numbers. I think they are self-descriptive enough.

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
circuit breaker behavior is described :ref:`here <arch_overview_circuit_break>`.
* upstream: changed load distribution algorithm when all priorities enter :ref:`panic mode<arch_overview_load_balancing_panic_threshold>`.
* zlib: by default zlib is initialized to use its default strategy (Z_DEFAULT_STRATEGY)
instead of the fixed one (Z_FIXED). The difference is that the use of dynammic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: typo "dynammic". I will fix this when I do the release cleanup.

Copy link
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, let's take this for 1.14.0.

@mattklein123 mattklein123 merged commit 4759d55 into envoyproxy:master Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants