Skip to content

Commit

Permalink
Sync docs
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaochao Dong (@damnever) <the.xcdong@gmail.com>
  • Loading branch information
damnever committed Jan 26, 2024
1 parent c9b1f7c commit 808bdc9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
12 changes: 12 additions & 0 deletions docs/components/query-frontend.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ config:
max_get_multi_batch_size: 0
dns_provider_update_interval: 0s
auto_discovery: false
set_async_circuit_breaker_enabled: false
set_async_circuit_breaker_half_open_max_requests: 0
set_async_circuit_breaker_open_duration: 0s
set_async_circuit_breaker_min_requests: 0
set_async_circuit_breaker_consecutive_failures: 0
set_async_circuit_breaker_failure_percent: 0
expiration: 0s
```

Expand Down Expand Up @@ -132,6 +138,12 @@ config:
master_name: ""
max_async_buffer_size: 10000
max_async_concurrency: 20
set_async_circuit_breaker_enabled: false
set_async_circuit_breaker_half_open_max_requests: 10
set_async_circuit_breaker_open_duration: 5s
set_async_circuit_breaker_min_requests: 50
set_async_circuit_breaker_consecutive_failures: 5
set_async_circuit_breaker_failure_percent: 0.05
expiration: 24h0m0s
```
Expand Down
18 changes: 18 additions & 0 deletions docs/components/store.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ config:
max_get_multi_batch_size: 0
dns_provider_update_interval: 0s
auto_discovery: false
set_async_circuit_breaker_enabled: false
set_async_circuit_breaker_half_open_max_requests: 0
set_async_circuit_breaker_open_duration: 0s
set_async_circuit_breaker_min_requests: 0
set_async_circuit_breaker_consecutive_failures: 0
set_async_circuit_breaker_failure_percent: 0
enabled_items: []
ttl: 0s
```
Expand All @@ -340,6 +346,12 @@ While the remaining settings are **optional**:
- `max_async_concurrency`: maximum number of concurrent asynchronous operations can occur.
- `max_async_buffer_size`: maximum number of enqueued asynchronous operations allowed.
- `max_get_multi_concurrency`: maximum number of concurrent connections when fetching keys. If set to `0`, the concurrency is unlimited.
- `set_async_circuit_breaker_enabled`: `true` to enable circuite breaker for asynchronous operations. The circuit breaker consists of three states: closed, half-open, and open. It begins in the closed state. When the total requests exceed `set_async_circuit_breaker_min_requests`, and either consecutive failures occur or the failure percentage is excessively high according to the configured values, the circuit breaker transitions to the open state. This results in the rejection of all asynchronous operations. After `set_async_circuit_breaker_open_duration`, the circuit breaker transitions to the half-open state, where it allows `set_async_circuit_breaker_half_open_max_requests` asynchronous operations to be processed in order to test if the conditions have improved. If they have not, the state transitions back to open; if they have, it transitions to the closed state. Following each 10 seconds interval in the closed state, the circuit breaker resets its metrics and repeats this cycle.
- `set_async_circuit_breaker_half_open_max_requests`: maximum number of requests allowed to pass through when the circuit breaker is half-open. If set to 0, the circuit breaker allows only 1 request.
- `set_async_circuit_breaker_open_duration`: the period of the open state after which the state of the circuit breaker becomes half-open. If set to 0, the circuit breaker resets it to 60 seconds.
- `set_async_circuit_breaker_min_requests`: minimal requests to trigger the circuit breaker, 0 signifies no requirements.
- `set_async_circuit_breaker_consecutive_failures`: consecutive failures based on `set_async_circuit_breaker_min_requests` to determine if the circuit breaker should open.
- `set_async_circuit_breaker_failure_percent`: the failure percentage, which is based on `set_async_circuit_breaker_min_requests`, to determine if the circuit breaker should open.
- `max_get_multi_batch_size`: maximum number of keys a single underlying operation should fetch. If more keys are specified, internally keys are splitted into multiple batches and fetched concurrently, honoring `max_get_multi_concurrency`. If set to `0`, the batch size is unlimited.
- `max_item_size`: maximum size of an item to be stored in memcached. This option should be set to the same value of memcached `-I` flag (defaults to 1MB) in order to avoid wasting network round trips to store items larger than the max item size allowed in memcached. If set to `0`, the item size is unlimited.
- `dns_provider_update_interval`: the DNS discovery update interval.
Expand Down Expand Up @@ -376,6 +388,12 @@ config:
master_name: ""
max_async_buffer_size: 10000
max_async_concurrency: 20
set_async_circuit_breaker_enabled: false
set_async_circuit_breaker_half_open_max_requests: 10
set_async_circuit_breaker_open_duration: 5s
set_async_circuit_breaker_min_requests: 50
set_async_circuit_breaker_consecutive_failures: 5
set_async_circuit_breaker_failure_percent: 0.05
enabled_items: []
ttl: 0s
```
Expand Down
10 changes: 0 additions & 10 deletions pkg/cacheutil/memcached_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,6 @@ type MemcachedClientConfig struct {
AutoDiscovery bool `yaml:"auto_discovery"`

// SetAsyncCircuitBreakerEnabled enables circuite breaker for SetAsync operations.
//
// The circuit breaker consists of three states: closed, half-open, and open.
// It begins in the closed state. When the total requests exceed SetAsyncCircuitBreakerMinRequests,
// and either consecutive failures occur or the failure percentage is excessively high according
// to the configured values, the circuit breaker transitions to the open state.
// This results in the rejection of all SetAsync requests. After SetAsyncCircuitBreakerOpenDuration,
// the circuit breaker transitions to the half-open state, where it allows SetAsyncCircuitBreakerHalfOpenMaxRequests
// SetAsync requests to be processed in order to test if the conditions have improved. If they have not,
// the state transitions back to open; if they have, it transitions to the closed state. Following each 10 seconds
// interval in the closed state, the circuit breaker resets its metrics and repeats this cycle.
SetAsyncCircuitBreakerEnabled bool `yaml:"set_async_circuit_breaker_enabled"`
// SetAsyncCircuitBreakerHalfOpenMaxRequests is the maximum number of requests allowed to pass through
// when the circuit breaker is half-open.
Expand Down
12 changes: 2 additions & 10 deletions pkg/cacheutil/redis_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var (
TLSConfig: TLSConfig{},
MaxAsyncConcurrency: 20,
MaxAsyncBufferSize: 10000,

SetAsyncCircuitBreakerEnabled: false,
SetAsyncCircuitBreakerHalfOpenMaxRequests: 10,
SetAsyncCircuitBreakerOpenDuration: 5 * time.Second,
SetAsyncCircuitBreakerMinRequests: 50,
Expand Down Expand Up @@ -126,16 +128,6 @@ type RedisClientConfig struct {
MaxAsyncConcurrency int `yaml:"max_async_concurrency"`

// SetAsyncCircuitBreakerEnabled enables circuite breaker for SetAsync operations.
//
// The circuit breaker consists of three states: closed, half-open, and open.
// It begins in the closed state. When the total requests exceed SetAsyncCircuitBreakerMinRequests,
// and either consecutive failures occur or the failure percentage is excessively high according
// to the configured values, the circuit breaker transitions to the open state.
// This results in the rejection of all SetAsync requests. After SetAsyncCircuitBreakerOpenDuration,
// the circuit breaker transitions to the half-open state, where it allows SetAsyncCircuitBreakerHalfOpenMaxRequests
// SetAsync requests to be processed in order to test if the conditions have improved. If they have not,
// the state transitions back to open; if they have, it transitions to the closed state. Following each 10 seconds
// interval in the closed state, the circuit breaker resets its metrics and repeats this cycle.
SetAsyncCircuitBreakerEnabled bool `yaml:"set_async_circuit_breaker_enabled"`
// SetAsyncCircuitBreakerHalfOpenMaxRequests is the maximum number of requests allowed to pass through
// when the circuit breaker is half-open.
Expand Down

0 comments on commit 808bdc9

Please sign in to comment.