forked from TrueCloudLab/frostfs-http-gw
[#184] Add config param for pool error threshold
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
af732d294c
commit
0f7737088d
5 changed files with 27 additions and 15 deletions
1
app.go
1
app.go
|
@ -114,6 +114,7 @@ func newApp(ctx context.Context, opt ...Option) App {
|
||||||
prm.SetNodeDialTimeout(a.cfg.GetDuration(cfgConTimeout))
|
prm.SetNodeDialTimeout(a.cfg.GetDuration(cfgConTimeout))
|
||||||
prm.SetHealthcheckTimeout(a.cfg.GetDuration(cfgReqTimeout))
|
prm.SetHealthcheckTimeout(a.cfg.GetDuration(cfgReqTimeout))
|
||||||
prm.SetClientRebalanceInterval(a.cfg.GetDuration(cfgRebalance))
|
prm.SetClientRebalanceInterval(a.cfg.GetDuration(cfgRebalance))
|
||||||
|
prm.SetErrorThreshold(a.cfg.GetUint32(cfgPoolErrorThreshold))
|
||||||
|
|
||||||
for i := 0; ; i++ {
|
for i := 0; ; i++ {
|
||||||
address := a.cfg.GetString(cfgPeers + "." + strconv.Itoa(i) + ".address")
|
address := a.cfg.GetString(cfgPeers + "." + strconv.Itoa(i) + ".address")
|
||||||
|
|
|
@ -83,6 +83,8 @@ HTTP_GW_CONNECT_TIMEOUT=5s
|
||||||
HTTP_GW_REQUEST_TIMEOUT=5s
|
HTTP_GW_REQUEST_TIMEOUT=5s
|
||||||
# Interval to check nodes health.
|
# Interval to check nodes health.
|
||||||
HTTP_GW_REBALANCE_TIMER=30s
|
HTTP_GW_REBALANCE_TIMER=30s
|
||||||
|
# The number of errors on connection after which node is considered as unhealthy
|
||||||
|
S3_GW_POOL_ERROR_THRESHOLD=100
|
||||||
|
|
||||||
# Enable zip compression to download files by common prefix.
|
# Enable zip compression to download files by common prefix.
|
||||||
HTTP_GW_ZIP_COMPRESSION=false
|
HTTP_GW_ZIP_COMPRESSION=false
|
||||||
|
|
|
@ -84,6 +84,7 @@ upload_header:
|
||||||
connect_timeout: 5s # Timeout to dial node.
|
connect_timeout: 5s # Timeout to dial node.
|
||||||
request_timeout: 5s # Timeout to check node health during rebalance.
|
request_timeout: 5s # Timeout to check node health during rebalance.
|
||||||
rebalance_timer: 30s # Interval to check nodes health.
|
rebalance_timer: 30s # Interval to check nodes health.
|
||||||
|
pool_error_threshold: 100 # The number of errors on connection after which node is considered as unhealthy.
|
||||||
|
|
||||||
zip:
|
zip:
|
||||||
compression: false # Enable zip compression to download files by common prefix.
|
compression: false # Enable zip compression to download files by common prefix.
|
||||||
|
|
|
@ -38,18 +38,20 @@ resolve_order:
|
||||||
connect_timeout: 5s
|
connect_timeout: 5s
|
||||||
request_timeout: 5s
|
request_timeout: 5s
|
||||||
rebalance_timer: 30s
|
rebalance_timer: 30s
|
||||||
|
pool_error_threshold: 100
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default value | Description |
|
| Parameter | Type | Default value | Description |
|
||||||
|-------------------|------------|----------------|------------------------------------------------------------------------------------|
|
|------------------------|------------|----------------|------------------------------------------------------------------------------------|
|
||||||
| `listen_address` | `string` | `0.0.0.0:8082` | The address that the gateway is listening on. |
|
| `listen_address` | `string` | `0.0.0.0:8082` | The address that the gateway is listening on. |
|
||||||
| `tls_certificate` | `string` | | Path to the TLS certificate. |
|
| `tls_certificate` | `string` | | Path to the TLS certificate. |
|
||||||
| `tls_key` | `string` | | Path to the TLS key. |
|
| `tls_key` | `string` | | Path to the TLS key. |
|
||||||
| `rpc_endpoint` | `string` | | The address of the RPC host to which the gateway connects to resolve bucket names. |
|
| `rpc_endpoint` | `string` | | The address of the RPC host to which the gateway connects to resolve bucket names. |
|
||||||
| `resolve_order` | `[]string` | `[nns, dns]` | Order of bucket name resolvers to use. |
|
| `resolve_order` | `[]string` | `[nns, dns]` | Order of bucket name resolvers to use. |
|
||||||
| `connect_timeout` | `duration` | `10s` | Timeout to connect to a node. |
|
| `connect_timeout` | `duration` | `10s` | Timeout to connect to a node. |
|
||||||
| `request_timeout` | `duration` | `15s` | Timeout to check node health during rebalance. |
|
| `request_timeout` | `duration` | `15s` | Timeout to check node health during rebalance. |
|
||||||
| `rebalance_timer` | `duration` | `60s` | Interval to check node health. |
|
| `rebalance_timer` | `duration` | `60s` | Interval to check node health. |
|
||||||
|
| `pool_error_threshold` | `uint32` | `100` | The number of errors on connection after which node is considered as unhealthy. |
|
||||||
|
|
||||||
# `wallet` section
|
# `wallet` section
|
||||||
|
|
||||||
|
|
14
settings.go
14
settings.go
|
@ -22,6 +22,8 @@ const (
|
||||||
|
|
||||||
defaultShutdownTimeout = 15 * time.Second
|
defaultShutdownTimeout = 15 * time.Second
|
||||||
|
|
||||||
|
defaultPoolErrorThreshold uint32 = 100
|
||||||
|
|
||||||
cfgListenAddress = "listen_address"
|
cfgListenAddress = "listen_address"
|
||||||
cfgTLSCertificate = "tls_certificate"
|
cfgTLSCertificate = "tls_certificate"
|
||||||
cfgTLSKey = "tls_key"
|
cfgTLSKey = "tls_key"
|
||||||
|
@ -40,10 +42,11 @@ const (
|
||||||
cfgPprofEnabled = "pprof.enabled"
|
cfgPprofEnabled = "pprof.enabled"
|
||||||
cfgPprofAddress = "pprof.address"
|
cfgPprofAddress = "pprof.address"
|
||||||
|
|
||||||
// Timeouts.
|
// Pool config.
|
||||||
cfgConTimeout = "connect_timeout"
|
cfgConTimeout = "connect_timeout"
|
||||||
cfgReqTimeout = "request_timeout"
|
cfgReqTimeout = "request_timeout"
|
||||||
cfgRebalance = "rebalance_timer"
|
cfgRebalance = "rebalance_timer"
|
||||||
|
cfgPoolErrorThreshold = "pool_error_threshold"
|
||||||
|
|
||||||
// Logger.
|
// Logger.
|
||||||
cfgLoggerLevel = "logger.level"
|
cfgLoggerLevel = "logger.level"
|
||||||
|
@ -122,6 +125,9 @@ func settings() *viper.Viper {
|
||||||
// logger:
|
// logger:
|
||||||
v.SetDefault(cfgLoggerLevel, "debug")
|
v.SetDefault(cfgLoggerLevel, "debug")
|
||||||
|
|
||||||
|
// pool:
|
||||||
|
v.SetDefault(cfgPoolErrorThreshold, defaultPoolErrorThreshold)
|
||||||
|
|
||||||
// web-server:
|
// web-server:
|
||||||
v.SetDefault(cfgWebReadBufferSize, 4096)
|
v.SetDefault(cfgWebReadBufferSize, 4096)
|
||||||
v.SetDefault(cfgWebWriteBufferSize, 4096)
|
v.SetDefault(cfgWebWriteBufferSize, 4096)
|
||||||
|
|
Loading…
Reference in a new issue