All Products
Search
Document Center

Alibaba Cloud Service Mesh:Description of ASMCompressor fields

Last Updated:Nov 30, 2023

Service Mesh (ASM) allows you to use ASMCompressor fields to perform compression settings. This topic describes the fields of ASMCompressor.

ASMCompressor fields

Field

Type

Required

Description

workloadSelector

map<string, string>

Yes

One or more labels that specify a set of pods on which the compression configurations take effect. The scope of label search is restricted to the namespace in which the resource resides. For more information, see Workload Selector.

isGateway

bool

No

Specifies whether to apply the configurations to a gateway. The value true indicates that the configurations apply to the gateway. Default value: false.

portNumber

int

Yes

The corresponding service port. If the configurations apply to a gateway, this field specifies the service port of the gateway.

compressor_library

CompressorLibrary

No

The configurations of the compression library.

request_direction_config

RequestDirectionConfig

No

The configurations in the request direction.

response_direction_config

ResponseDirectionConfig

No

The configurations in the response direction.

CompressorLibrary fields

Field

Type

Required

Description

gzip

GzipCompressor

No

The Gzip compression configurations.

brotli

BrotliCompressor

No

Brotli compression configurations.

GzipCompressor fields

Field

Type

Required

Description

Default

window_bits

int

No

The window size. Valid values: 9 to 15. A larger value indicates better compression effect but greater memory consumption.

12

compression_level

string

No

The compression level, which affects the compression speed and size. Valid values:

  • BEST: high compression ratio and high latency.

  • SPEED: low compression ratio and low latency.

  • DEFAULT: a trade-off solution between BEST and SPEED.

DEFAULT

memory_level

int

No

The memory level. Valid values: 1 to 9. This parameter controls the memory usage of the compression library. A larger value increases the memory consumption, but the compression speed is faster and the compression result is better.

5

compression_strategy

string

No

Specifies the zlib compression policy, which is directly related to the characteristics of the content to be compressed. Valid values:

  • DEFAULT_STRATEGY: indicates the default compression policy. This policy is automatically selected by the zlib library based on the characteristics of the input data to obtain the best compression effect.

  • FILTERED: indicates that a compression policy with a filter is used. This policy is typically used to compress a data stream multiple times to increase the compression ratio.

  • HUFFMAN_ONLY: indicates a compression policy that uses only Huffman coding. This policy is typically used when only Huffman coding is used and the LZ77 algorithm is not used.

  • RLE: indicates a compression policy that uses run-length encoding (RLE). This policy is typically used for data with a large number of continuously repeating characters or continuously repeating patterns.

  • FIXED: indicates a compression policy that uses a fixed dictionary. This policy is typically used for compressing data in specific patterns, where the compression dictionary is known or predefined in advance.

DEFAULT_STRATEGY

BrotliCompressor fields

Field

Type

Required

Description

Default

window_bits

int

No

The window size. Valid values: 10 to 24. A larger value indicates better compression effect but greater memory consumption.

18

quality

int

No

The quality, which controls the compression speed. Valid values: 0 to 11. The higher the compression quality, the slower the compression speed.

3

RequestDirectionConfig fields

Field

Type

Required

Description

Default

common_config

CommonConfig

No

The configuration of the filter behavior in the request direction.

N/A

ResponseDirectionConfig fields

Field

Type

Required

Description

Default

common_config

CommonConfig

No

The configuration of the filter behavior in the response direction.

N/A

disable_on_etag_header

bool

No

If the value of this field is true, compression is disabled when a response contains an etag header.

false

remove_accept_encoding_header

bool

No

If the value of this field is true, the acceptance encoding is removed from a request header before it is routed to the upstream, so that the response is not compressed before it reaches the filter.

false

CommonConfig fields

Field

Description

Default

min_content_length

The minimum length of content for which compression is enabled. Multiple request trials are required to find the best value for the most appropriate configuration. Gzip compression uses more CPU resources to provide a higher compression ratio and may introduce more latency.

N/A

content_type

The types of content for which compression is enabled.

"application/javascript", "application/json", "application/xhtml+xml", "image/svg+xml", "text/css", "text/html", "text/plain", "text/xml"

References

Use ASMCompressor to define compression configurations for calls between application services