Skip to content

Commit

Permalink
support set async circuit breaker for memcached and redis client (#5789)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
yeya24 authored Feb 26, 2024
1 parent 33b44bf commit c033170
Show file tree
Hide file tree
Showing 26 changed files with 920 additions and 88 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [FEATURE] Tracing: Add `tracing.otel.round-robin` flag to use `round_robin` gRPC client side LB policy for sending OTLP traces. #5731
* [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
* [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
* [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
* [ENHANCEMENT] Store Gateway: Added `-store-gateway.enabled-tenants` and `-store-gateway.disabled-tenants` to explicitly enable or disable store-gateway for specific tenants. #5638
* [ENHANCEMENT] Compactor: Add new compactor metric `cortex_compactor_start_duration_seconds`. #5683
* [ENHANCEMENT] Upgraded Docker base images to `alpine:3.18`. #5684
Expand Down
174 changes: 174 additions & 0 deletions docs/blocks-storage/querier.md
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.auto-discovery
[auto_discovery: <boolean> | default = false]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

# Selectively cache index item types. Supported values are Postings,
# ExpandedPostings and Series
# CLI flag: -blocks-storage.bucket-store.index-cache.memcached.enabled-items
Expand Down Expand Up @@ -707,6 +736,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.cache-size
[cache_size: <int> | default = 0]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

# Selectively cache index item types. Supported values are Postings,
# ExpandedPostings and Series
# CLI flag: -blocks-storage.bucket-store.index-cache.redis.enabled-items
Expand Down Expand Up @@ -779,6 +837,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.auto-discovery
[auto_discovery: <boolean> | default = false]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.memcached.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

redis:
# Comma separated list of redis addresses. Supported prefixes are: dns+
# (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV query,
Expand Down Expand Up @@ -875,6 +962,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.cache-size
[cache_size: <int> | default = 0]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.redis.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

# Size of each subrange that bucket object is split into for better
# caching.
# CLI flag: -blocks-storage.bucket-store.chunks-cache.subrange-size
Expand Down Expand Up @@ -946,6 +1062,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.auto-discovery
[auto_discovery: <boolean> | default = false]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.memcached.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

redis:
# Comma separated list of redis addresses. Supported prefixes are: dns+
# (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV query,
Expand Down Expand Up @@ -1042,6 +1187,35 @@ blocks_storage:
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.cache-size
[cache_size: <int> | default = 0]

set_async_circuit_breaker_config:
# If true, enable circuit breaker.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.enabled
[enabled: <boolean> | default = false]

# Maximum number of requests allowed to pass through when the circuit
# breaker is half-open. If set to 0, by default it allows 1 request.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.half-open-max-requests
[half_open_max_requests: <int> | default = 10]

# Period of the open state after which the state of the circuit
# breaker becomes half-open. If set to 0, by default open duration is
# 60 seconds.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.open-duration
[open_duration: <duration> | default = 5s]

# Minimal requests to trigger the circuit breaker.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.min-requests
[min_requests: <int> | default = 50]

# Consecutive failures to determine if the circuit breaker should
# open.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.consecutive-failures
[consecutive_failures: <int> | default = 5]

# Failure percentage to determine if the circuit breaker should open.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.redis.set-async.circuit-breaker.failure-percent
[failure_percent: <float> | default = 0.05]

# How long to cache list of tenants in the bucket.
# CLI flag: -blocks-storage.bucket-store.metadata-cache.tenants-list-ttl
[tenants_list_ttl: <duration> | default = 15m]
Expand Down
Loading

0 comments on commit c033170

Please sign in to comment.