All Products
Search
Document Center

Alibaba Cloud Service Mesh:Description of ASMCompressor fields

Last Updated:Jul 01, 2024

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

You can specify one or more labels to define a set of pods on which the corresponding 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 are applied to the gateway. Default value: false.

portNumber

int

Yes

The corresponding service port. If the configurations are applied 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.

per_route_configs

ASMCompressorPerRouteConfig

No

The compression configuration at the route level (supported since ASM V1.21).

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 value

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 accelerates compression and optimizes compression results but increases memory consumption.

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 value

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 value

common_config

CommonConfig

No

The configuration of the filter behavior in the request direction.

N/A

ResponseDirectionConfig fields

Field

Type

Required

Description

Default value

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. This way, the response is not compressed before it reaches the filter.

false

CommonConfig fields

Field

Description

Default value

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"

ASMCompressorPerRouteConfig fields

Field

Type

Required

Description

route_match

RouteConfigurationMatch

Yes

The route on which the configuration takes effect.

disabled

bool

Yes

Default value: false. If the value is set to true, the compression feature is disabled for the specified route.

RouteConfigurationMatch fields

Field

Type

Required

Description

portNumber

uint32

No

The service port or the port of a specific server in the Gateway. If this field is left empty, all ports are matched.

portName

string

No

This field takes effect only when the compression policy is applied to a gateway. You can set the value of this field to that of the portName field of a specific server in the Gateway.

gateway

string

No

The namespace and name of the specified Gateway in the namespace/name format. This field can be configured only when the compression policy is applied to a gateway. You can use this field with portName and portNumber to accurately select a specific server in a Gateway.

vhost

CommonVirtualHostMatch

No

Match a specific virtual host.

name

string

No

The name of the route configuration that you want to match. To configure this field, you need to be familiar with the Envoy configuration.

CommonVirtualHostMatch fields

Field

Type

Required

Description

name

string

No

The name of a virtual host that is generated on the control plane. The value is in the host:port format. host corresponds to the host field of the related virtual service or the service name, namely fully qualified domain name (FQDN), in the related cluster.

route

CommonRouteMatch

No

Match a specific route within the virtual host.

CommonRouteMatch fields

Field

Type

Required

Description

name

string

No

The Route objects generated by default are named default. If you configure a virtual service, you must enter the name of a HTTP route in the virtual service.

action

string

No

Match a route with specific action type. Valid values: ROUTE, REDIRECT, DIRECT_RESPONSE, and ANY. Default value: ANY.

References

Use ASMCompressor to define compression configurations for calls between application services