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 | No | The configurations of the compression library. | |
request_direction_config | No | The configurations in the request direction. | |
response_direction_config | No | The configurations in the response direction. |
CompressorLibrary fields
Field | Type | Required | Description |
gzip | No | The Gzip compression configurations. | |
brotli | 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:
| 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 |
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 | No | The configuration of the filter behavior in the request direction. | N/A |
ResponseDirectionConfig fields
Field | Type | Required | Description | Default |
common_config | 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