Support snappy compression in query frontend cache#3207
Support snappy compression in query frontend cache#3207bwplotka merged 4 commits intothanos-io:masterfrom
Conversation
Signed-off-by: Ben Ye <yb532204897@gmail.com>
Signed-off-by: Ben Ye <yb532204897@gmail.com>
cmd/thanos/query_frontend.go
Outdated
|
|
||
| cfg.CachePathOrContent = *extflag.RegisterPathOrContent(cmd, "query-range.response-cache-config", "YAML file that contains response cache configuration.", false) | ||
|
|
||
| cmd.Flag("query-range.compression", "Use compression in results cache. Supported values are: 'snappy' and '' (disable compression)."). |
There was a problem hiding this comment.
Can we elaborate when it is used? On response? or when put in Memcached ?
There was a problem hiding this comment.
Also, maybe query-range.compression-type?
There was a problem hiding this comment.
Yes, it is used before storing the response to Memcached. It doesn't make sense to use it when only fifo-cache is enabled. I should document that.
I am okay with either query-range.compression-type or query-range.compression. The flag is named to compression in Cortex
There was a problem hiding this comment.
Yes, it is used before storing the response to Memcached. It doesn't make sense to use it when only fifo-cache is enabled. I should document that.
But it will work for other non FIFO backends as well, right? 🤔
There was a problem hiding this comment.
Yes, it compresses the response and then sends it to the results cache backend. If it is fifo-cache, because snappy cache and fifo cache are in memory, so not needed.
There was a problem hiding this comment.
Technically it could be needed -> It might reduce memory consumed as well (:
But yea, the question is what is available right now (:
There was a problem hiding this comment.
Yeah you are right. Sorry, my mistake. It is a tradeoff between CPU and Memory & network traffic
There was a problem hiding this comment.
No need to be sorry - I think it's extremely useful. The only question is, do we need this for query range or some global cache option? (for future labels and instant)?
I think we need it for all so maybe some generic:
| cmd.Flag("query-range.compression", "Use compression in results cache. Supported values are: 'snappy' and '' (disable compression)."). | |
| cmd.Flag("cache-compression-type", "Use compression in results cache. Supported values are: 'snappy' and '' (disable compression)."). |
There was a problem hiding this comment.
I think the option can be global. But considering other caching configs, I am not sure. This is another problem and maybe we can have a separate issue to talk about it. The main question is, can we use different cache backends and different cache configs for each endpoint we want to cache? @bwplotka @kakkoyun
For example, it is not very good to reuse the same cache config because the response sizes are different for range queries and instant queries. They might need different limits and different max_items configs.
There was a problem hiding this comment.
Totally agree. To me, something will be the same, some things different (:
Signed-off-by: Ben Ye <yb532204897@gmail.com>
57ac41d to
800e2df
Compare
|
Umm, this flaky test is new. Is it related to the new TSDB update? @bwplotka Can you please take a look? https://app.circleci.com/jobs/github/thanos-io/thanos/11833 |
CHANGELOG.md
Outdated
| - [#3154](https://github.com/thanos-io/thanos/pull/3154) Query Frontend: Add metric `thanos_memcached_getmulti_gate_queries_max`. | ||
| - [#3146](https://github.com/thanos-io/thanos/pull/3146) Sidecar: Add `thanos_sidecar_prometheus_store_received_frames` histogram metric. | ||
| - [#3147](https://github.com/thanos-io/thanos/pull/3147) Querier: Add `query.metadata.default-time-range` flag to specify the default metadata time range duration for retrieving labels through Labels and Series API when the range parameters are not specified. The zero value means range covers the time since the beginning. | ||
| - [#3207](https://github.com/thanos-io/thanos/pull/3207) Query Frontend: Add `query-range.compression` flag to use compression in the query frontend cache. |
There was a problem hiding this comment.
| - [#3207](https://github.com/thanos-io/thanos/pull/3207) Query Frontend: Add `query-range.compression` flag to use compression in the query frontend cache. | |
| - [#3207](https://github.com/thanos-io/thanos/pull/3207) Query Frontend: Add `cache-compression-type` flag to use compression in the query frontend cache. |
There was a problem hiding this comment.
Thanks for the catch! Please take a look again.
Signed-off-by: Ben Ye <yb532204897@gmail.com>
|
Thanks! |
Signed-off-by: Ben Ye yb532204897@gmail.com
Changes
This pr adds snappy compression support to the query frontend and bumps Cortex dependency to the latest master.
Verification