-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow compression for the Envoy stats endpoint #30987
Comments
I don't think Envoy supports compressed stats. The gzip HTTP filter you are trying to configure does not compress stats. It is used for request compression. It would probably be better to open an issue at upstream Envoy first. Istio should be able to adopt this with no problem. |
The envoyfilter doesn't work since the stats listener is static configuration. @bianpengyuan what is the difference between request compression and stats compression? |
Ah I see, the intent is to inject compression into the stats listener. I was thinking supporting compression directly at Envoy's prometheus endpoint, based on content type requested by the client. That way there is no extra filter needed. |
For clarification: We want to scrape compressed metrics directly from the istio-proxy pod. I don't know what possible options we have to achieve this. So according to your comments I have to open an Envoy issue, right? |
You just need to add the gzip filter directly to the 15090 listener in the bootstrap. You can see an example of this in samples/custom-bootstrap |
This means we have to:
I tried to use the Would it be okay to create a PR that adds this to the original bootstrap template? |
You only need to provide the patch itself with custom bootstrap. No need to provide the whole patched Envoy bootstrap. And the patch needs to be mounted to the workload pod instead of istiod. |
Thanks @bianpengyuan. I completely missed that those values would be merged. Thank you. I got a working example and our network usage went down from ~20MBytes/s to ~30KBytes/s (yes, from Mega to Kilo 🔥). First I thought there was any error, but the data was complete and I did a short check with my CLI:
It is only 2.35% of its original size and both have the same mount of lines! The problem is now solved for us, but it might make sense to add the compression feature to the upstream bootstrap templates. Here is our configuration for completeness.
apiVersion: v1
kind: ConfigMap
metadata:
annotations:
name: istio-custom-bootstrap-config
namespace: default
data:
custom_bootstrap.json: |-
{
"staticResources": {
"listeners": [
{
"address": {
"socketAddress": {
"address": "0.0.0.0",
"portValue": 14090
}
},
"filterChains": [
{
"filters": [
{
"name": "envoy.filters.network.http_connection_manager",
"typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager",
"httpFilters": [
{
"name": "envoy.filters.http.compressor",
"typed_config": {
"@type": "type.googleapis.com/envoy.extensions.filters.http.compressor.v3.Compressor",
"compressor_library": {
"name": "text_optimized",
"typed_config": {
"@type": "type.googleapis.com/envoy.extensions.compression.gzip.compressor.v3.Gzip"
}
},
"remove_accept_encoding_header": true
}
},
{
"name": "envoy.filters.http.router",
"typedConfig": {
"@type": "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router"
}
}
],
"routeConfig": {
"virtualHosts": [
{
"domains": [
"*"
],
"name": "backend",
"routes": [
{
"match": {
"prefix": "/stats/prometheus"
},
"route": {
"cluster": "prometheus_stats"
}
}
]
}
]
},
"statPrefix": "stats"
}
}
]
}
]
}
]
}
} |
@svenwltr Thanks for providing the configuration! It will be useful for future referencing. We will consider have this as an option when more people want this. Thanks! |
GZIP in sidecar metrics is cool |
FWIW, the cumbersome workaround using a secondary metrics port with a gzip compression filter, greatly reduced interzone traffic in our cluster resulting in about €300 per month savings in cloud spending. |
gzip support really needs to be the default 💦 |
I'm trying to get compression working for merged metrics. I started with the configuration described in the comment above. This made it possible to scrape compressed metrics on port 14090. What I don't understand is how to route the traffic for port 15020 to this listener. Can anybody give me a hint? |
Just to let everyone know, that this feature was released with Istio 1.21.0 (#47997) and it is really easy now. Thanks @zirain et al! Add the annotation |
Describe the feature request
It should be possible to enable gzip compression for the Envoy stats endpoint (
http://127.0.0.1:15090/stats/prometheus
) to save some bandwidth. Currently it does not seem to be the case:Describe alternatives you've considered
I tried configuring an EnvoyFilter to enable compression, but I lack knowledge of the Envoy internals and the filter concept.
Details
I tried crafting a filter filter, but it does not work. Disclaimer: This is also a Stackoverflow question. This is my latest attempt:
[ ] Docs
[ ] Installation
[x] Networking
[x] Performance and Scalability
[ ] Extensions and Telemetry
[ ] Security
[ ] Test and Release
[ ] User Experience
[ ] Developer Infrastructure
Additional context
Currently, we have around 100 Pods with an Istio sidecar and we are aiming to increase that number. For scaling reasons we did split our Prometheus instances into two parts: One for the Envoy Metrics and one for the actual application metrics. This means we disabled metric merging and are pointing one Prometheus instance directly to
:15090/stats/prometheus
endpoint of each pod.The text was updated successfully, but these errors were encountered: