Skip to content

Commit c033170

Browse files
authored
support set async circuit breaker for memcached and redis client (#5789)
* support set async circuit breaker for memcached and redis client Signed-off-by: Ben Ye <[email protected]> * changelog Signed-off-by: Ben Ye <[email protected]> * docs Signed-off-by: Ben Ye <[email protected]> --------- Signed-off-by: Ben Ye <[email protected]>
1 parent 33b44bf commit c033170

26 files changed

+920
-88
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* [FEATURE] Tracing: Add `tracing.otel.round-robin` flag to use `round_robin` gRPC client side LB policy for sending OTLP traces. #5731
1414
* [FEATURE] Ruler: Add `ruler.concurrent-evals-enabled` flag to enable concurrent evaluation within a single rule group for independent rules. Maximum concurrency can be configured via `ruler.max-concurrent-evals`. #5766
1515
* [FEATURE] Distributor Queryable: Experimental: Add config `zone_results_quorum_metadata`. When querying ingesters using metadata APIs such as label names and values, only results from quorum number of zones will be included and merged. #5779
16+
* [FEATURE] Storage Cache Clients: Add config `set_async_circuit_breaker_config` to utilize the circuit breaker pattern for dynamically thresholding asynchronous set operations. Implemented in both memcached and redis cache clients. #5789
1617
* [ENHANCEMENT] Store Gateway: Added `-store-gateway.enabled-tenants` and `-store-gateway.disabled-tenants` to explicitly enable or disable store-gateway for specific tenants. #5638
1718
* [ENHANCEMENT] Compactor: Add new compactor metric `cortex_compactor_start_duration_seconds`. #5683
1819
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.18`. #5684

docs/blocks-storage/querier.md

+174
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,35 @@ blocks_storage:
606606
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.auto-discovery
607607
[auto_discovery: <boolean> | default = false]
608608

609+
set_async_circuit_breaker_config:
610+
# If true, enable circuit breaker.
611+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.enabled
612+
[enabled: <boolean> | default = false]
613+
614+
# Maximum number of requests allowed to pass through when the circuit
615+
# breaker is half-open. If set to 0, by default it allows 1 request.
616+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.half-open-max-requests
617+
[half_open_max_requests: <int> | default = 10]
618+
619+
# Period of the open state after which the state of the circuit
620+
# breaker becomes half-open. If set to 0, by default open duration is
621+
# 60 seconds.
622+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.open-duration
623+
[open_duration: <duration> | default = 5s]
624+
625+
# Minimal requests to trigger the circuit breaker.
626+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.min-requests
627+
[min_requests: <int> | default = 50]
628+
629+
# Consecutive failures to determine if the circuit breaker should
630+
# open.
631+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.consecutive-failures
632+
[consecutive_failures: <int> | default = 5]
633+
634+
# Failure percentage to determine if the circuit breaker should open.
635+
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.failure-percent
636+
[failure_percent: <float> | default = 0.05]
637+
609638
# Selectively cache index item types. Supported values are Postings,
610639
# ExpandedPostings and Series
611640
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.enabled-items
@@ -707,6 +736,35 @@ blocks_storage:
707736
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.cache-size
708737
[cache_size: <int> | default = 0]
709738

739+
set_async_circuit_breaker_config:
740+
# If true, enable circuit breaker.
741+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.enabled
742+
[enabled: <boolean> | default = false]
743+
744+
# Maximum number of requests allowed to pass through when the circuit
745+
# breaker is half-open. If set to 0, by default it allows 1 request.
746+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.half-open-max-requests
747+
[half_open_max_requests: <int> | default = 10]
748+
749+
# Period of the open state after which the state of the circuit
750+
# breaker becomes half-open. If set to 0, by default open duration is
751+
# 60 seconds.
752+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.open-duration
753+
[open_duration: <duration> | default = 5s]
754+
755+
# Minimal requests to trigger the circuit breaker.
756+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.min-requests
757+
[min_requests: <int> | default = 50]
758+
759+
# Consecutive failures to determine if the circuit breaker should
760+
# open.
761+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.consecutive-failures
762+
[consecutive_failures: <int> | default = 5]
763+
764+
# Failure percentage to determine if the circuit breaker should open.
765+
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.failure-percent
766+
[failure_percent: <float> | default = 0.05]
767+
710768
# Selectively cache index item types. Supported values are Postings,
711769
# ExpandedPostings and Series
712770
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.enabled-items
@@ -779,6 +837,35 @@ blocks_storage:
779837
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.auto-discovery
780838
[auto_discovery: <boolean> | default = false]
781839

840+
set_async_circuit_breaker_config:
841+
# If true, enable circuit breaker.
842+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.enabled
843+
[enabled: <boolean> | default = false]
844+
845+
# Maximum number of requests allowed to pass through when the circuit
846+
# breaker is half-open. If set to 0, by default it allows 1 request.
847+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.half-open-max-requests
848+
[half_open_max_requests: <int> | default = 10]
849+
850+
# Period of the open state after which the state of the circuit
851+
# breaker becomes half-open. If set to 0, by default open duration is
852+
# 60 seconds.
853+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.open-duration
854+
[open_duration: <duration> | default = 5s]
855+
856+
# Minimal requests to trigger the circuit breaker.
857+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.min-requests
858+
[min_requests: <int> | default = 50]
859+
860+
# Consecutive failures to determine if the circuit breaker should
861+
# open.
862+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.consecutive-failures
863+
[consecutive_failures: <int> | default = 5]
864+
865+
# Failure percentage to determine if the circuit breaker should open.
866+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.failure-percent
867+
[failure_percent: <float> | default = 0.05]
868+
782869
redis:
783870
# Comma separated list of redis addresses. Supported prefixes are: dns+
784871
# (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV query,
@@ -875,6 +962,35 @@ blocks_storage:
875962
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.cache-size
876963
[cache_size: <int> | default = 0]
877964

965+
set_async_circuit_breaker_config:
966+
# If true, enable circuit breaker.
967+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.enabled
968+
[enabled: <boolean> | default = false]
969+
970+
# Maximum number of requests allowed to pass through when the circuit
971+
# breaker is half-open. If set to 0, by default it allows 1 request.
972+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.half-open-max-requests
973+
[half_open_max_requests: <int> | default = 10]
974+
975+
# Period of the open state after which the state of the circuit
976+
# breaker becomes half-open. If set to 0, by default open duration is
977+
# 60 seconds.
978+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.open-duration
979+
[open_duration: <duration> | default = 5s]
980+
981+
# Minimal requests to trigger the circuit breaker.
982+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.min-requests
983+
[min_requests: <int> | default = 50]
984+
985+
# Consecutive failures to determine if the circuit breaker should
986+
# open.
987+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.consecutive-failures
988+
[consecutive_failures: <int> | default = 5]
989+
990+
# Failure percentage to determine if the circuit breaker should open.
991+
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.failure-percent
992+
[failure_percent: <float> | default = 0.05]
993+
878994
# Size of each subrange that bucket object is split into for better
879995
# caching.
880996
# CLI flag: -blocks-storage.bucket-store.chunks-cache.subrange-size
@@ -946,6 +1062,35 @@ blocks_storage:
9461062
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.auto-discovery
9471063
[auto_discovery: <boolean> | default = false]
9481064

1065+
set_async_circuit_breaker_config:
1066+
# If true, enable circuit breaker.
1067+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.enabled
1068+
[enabled: <boolean> | default = false]
1069+
1070+
# Maximum number of requests allowed to pass through when the circuit
1071+
# breaker is half-open. If set to 0, by default it allows 1 request.
1072+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.half-open-max-requests
1073+
[half_open_max_requests: <int> | default = 10]
1074+
1075+
# Period of the open state after which the state of the circuit
1076+
# breaker becomes half-open. If set to 0, by default open duration is
1077+
# 60 seconds.
1078+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.open-duration
1079+
[open_duration: <duration> | default = 5s]
1080+
1081+
# Minimal requests to trigger the circuit breaker.
1082+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.min-requests
1083+
[min_requests: <int> | default = 50]
1084+
1085+
# Consecutive failures to determine if the circuit breaker should
1086+
# open.
1087+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.consecutive-failures
1088+
[consecutive_failures: <int> | default = 5]
1089+
1090+
# Failure percentage to determine if the circuit breaker should open.
1091+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.failure-percent
1092+
[failure_percent: <float> | default = 0.05]
1093+
9491094
redis:
9501095
# Comma separated list of redis addresses. Supported prefixes are: dns+
9511096
# (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV query,
@@ -1042,6 +1187,35 @@ blocks_storage:
10421187
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.cache-size
10431188
[cache_size: <int> | default = 0]
10441189

1190+
set_async_circuit_breaker_config:
1191+
# If true, enable circuit breaker.
1192+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.enabled
1193+
[enabled: <boolean> | default = false]
1194+
1195+
# Maximum number of requests allowed to pass through when the circuit
1196+
# breaker is half-open. If set to 0, by default it allows 1 request.
1197+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.half-open-max-requests
1198+
[half_open_max_requests: <int> | default = 10]
1199+
1200+
# Period of the open state after which the state of the circuit
1201+
# breaker becomes half-open. If set to 0, by default open duration is
1202+
# 60 seconds.
1203+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.open-duration
1204+
[open_duration: <duration> | default = 5s]
1205+
1206+
# Minimal requests to trigger the circuit breaker.
1207+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.min-requests
1208+
[min_requests: <int> | default = 50]
1209+
1210+
# Consecutive failures to determine if the circuit breaker should
1211+
# open.
1212+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.consecutive-failures
1213+
[consecutive_failures: <int> | default = 5]
1214+
1215+
# Failure percentage to determine if the circuit breaker should open.
1216+
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.failure-percent
1217+
[failure_percent: <float> | default = 0.05]
1218+
10451219
# How long to cache list of tenants in the bucket.
10461220
# CLI flag: -blocks-storage.bucket-store.metadata-cache.tenants-list-ttl
10471221
[tenants_list_ttl: <duration> | default = 15m]

0 commit comments

Comments
 (0)