-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Adding to Thanos' Redis cache config a prefix option.
If configured, all cache keys used by the Thanos component will use this prefix.
This is a pretty small and simple backwards-compatible change that can be added to improve the Redis Cache support.
Using prefixes is a common practice when using Redis and is used to achieve better isolation.
Currently, there is support for choosing a DB, which is a form of isolation. However, prefixes allow for even more customizability in that front with no real downsides.
Below is the suggested new default config redis:
type: REDIS
config:
addr: ""
username: ""
password: ""
db: 0
prefix: "" # New
dial_timeout: 5s
read_timeout: 3s
write_timeout: 3s
max_get_multi_concurrency: 100
get_multi_batch_size: 100
max_set_multi_concurrency: 100
set_multi_batch_size: 100
tls_enabled: false
tls_config:
ca_file: ""
cert_file: ""
key_file: ""
server_name: ""
insecure_skip_verify: false
cache_size: 0
master_name: ""
max_async_buffer_size: 10000
max_async_concurrency: 20
set_async_circuit_breaker_config:
enabled: false
half_open_max_requests: 10
open_duration: 5s
min_requests: 50
consecutive_failures: 5
failure_percent: 0.05
expiration: 24h0m0sBy setting the default value "", we ensure users who are not interested in this feature won't be affected by it.
We can for example, set the prefix for the query-frontend component to frontend and the prefix for the store-gateway component to store and by that achieve easy and simple isolation between the two, even if they use the same Redis instance and DB.
Needless to say this also helps with integration with other, none-Thanos components which might also use Redis with their own prefix.
I would love to hear more about what everyone has to say on the matter, and I also hope to potentially see this implemented in the near future - as it can be quite handy.