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 | 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. | |
per_route_configs | No | The compression configuration at the route level (supported since ASM V1.21). |
CompressorLibrary fields
Field | Type | Required | Description |
gzip | No | The Gzip compression configurations. | |
brotli | 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:
| 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 |
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 | No | The configuration of the filter behavior in the request direction. | N/A |
ResponseDirectionConfig fields
Field | Type | Required | Description | Default value |
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. 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 | 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 |
gateway | string | No | The namespace and name of the specified Gateway in the |
vhost | 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 |
route | 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 |
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