From 7734be609cac88c49f57c68d98d8d5e69da29ed9 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 9 Jun 2021 19:26:27 +0300 Subject: [PATCH] [#60] Dropped grpc keepalive options Signed-off-by: Denis Kirillov --- README.md | 9 ++++++--- app.go | 3 --- go.mod | 2 +- go.sum | 4 ++-- settings.go | 14 -------------- 5 files changed, 9 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 5ff0445..a757896 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,11 @@ backend node (and otherwise default settings): $ neofs-http-gw -p 192.168.130.72:8080 $ HTTP_GW_PEERS_0_ADDRESS=192.168.130.72:8080 neofs-http-gw ``` +It's also possible to specify uri scheme (grpc or grpcs) when using `-p`: +``` +$ neofs-http-gw -p grpc://192.168.130.72:8080 +$ HTTP_GW_PEERS_0_ADDRESS=grpcs://192.168.130.72:8080 neofs-http-gw +``` ## Configuration @@ -145,9 +150,7 @@ default. To enable them use `--pprof` and `--metrics` flags or You can tune gRPC interface parameters with `--connect_timeout` (for connection to node) and `--request_timeout` (for request processing over -established connection) options as well as `HTTP_GW_KEEPALIVE_TIME` -(peer pinging interval), `HTTP_GW_KEEPALIVE_TIMEOUT` (peer pinging timeout) -and `HTTP_GW_KEEPALIVE_PERMIT_WITHOUT_STREAM` environment variables. +established connection) options. gRPC-level checks allow gateway to detect dead peers, but it declares them unhealthy at pool level once per `--rebalance_timer` interval, so check for it diff --git a/app.go b/app.go index 8e89484..86da641 100644 --- a/app.go +++ b/app.go @@ -119,9 +119,6 @@ func newApp(ctx context.Context, opt ...Option) App { NodeRequestTimeout: a.cfg.GetDuration(cfgReqTimeout), ClientRebalanceInterval: a.cfg.GetDuration(cfgRebalance), SessionExpirationEpoch: math.MaxUint64, - KeepaliveTime: a.cfg.GetDuration(cfgKeepaliveTime), - KeepaliveTimeout: a.cfg.GetDuration(cfgKeepaliveTimeout), - KeepalivePermitWoStream: a.cfg.GetBool(cfgKeepalivePermitWithoutStream), } a.pool, err = pb.Build(ctx, opts) if err != nil { diff --git a/go.mod b/go.mod index 12535bb..2aaa8e3 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/mr-tron/base58 v1.1.3 // indirect github.com/nspcc-dev/neofs-api-go v1.27.0 github.com/nspcc-dev/neofs-crypto v0.3.0 - github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a + github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210609143631-0d3c078a0d9b github.com/prometheus/client_golang v1.9.0 github.com/prometheus/common v0.15.0 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index 9d80a35..90c40de 100644 --- a/go.sum +++ b/go.sum @@ -319,8 +319,8 @@ github.com/nspcc-dev/neofs-crypto v0.2.0/go.mod h1:F/96fUzPM3wR+UGsPi3faVNmFlA9K github.com/nspcc-dev/neofs-crypto v0.2.3/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= github.com/nspcc-dev/neofs-crypto v0.3.0 h1:zlr3pgoxuzrmGCxc5W8dGVfA9Rro8diFvVnBg0L4ifM= github.com/nspcc-dev/neofs-crypto v0.3.0/go.mod h1:8w16GEJbH6791ktVqHN9YRNH3s9BEEKYxGhlFnp0cDw= -github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a h1:bVvyR+Y+UmElTFKY0ifjtvWteYSm93jihKV1rh4wW5s= -github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210604112451-f16d38c7b92a/go.mod h1:1djNrOkpTTbNUlJM/MvTmohJUaWKUMy9JHSCCA8rJEc= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210609143631-0d3c078a0d9b h1:2alc6tGPHScEATOxlrYuHCTl+DbhVaqigT5Bo1QXY90= +github.com/nspcc-dev/neofs-sdk-go v0.0.0-20210609143631-0d3c078a0d9b/go.mod h1:1djNrOkpTTbNUlJM/MvTmohJUaWKUMy9JHSCCA8rJEc= github.com/nspcc-dev/rfc6979 v0.1.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= github.com/nspcc-dev/rfc6979 v0.2.0 h1:3e1WNxrN60/6N0DW7+UYisLeZJyfqZTNOjeV/toYvOE= github.com/nspcc-dev/rfc6979 v0.2.0/go.mod h1:exhIh1PdpDC5vQmyEsGvc4YDM/lyQp/452QxGq/UEso= diff --git a/settings.go b/settings.go index 21de46e..bf26d2c 100644 --- a/settings.go +++ b/settings.go @@ -23,18 +23,10 @@ const ( defaultRequestTimeout = 15 * time.Second defaultConnectTimeout = 30 * time.Second - defaultKeepaliveTime = 10 * time.Second - defaultKeepaliveTimeout = 10 * time.Second - cfgListenAddress = "listen_address" cfgTLSCertificate = "tls_certificate" cfgTLSKey = "tls_key" - // KeepAlive. - cfgKeepaliveTime = "keepalive.time" - cfgKeepaliveTimeout = "keepalive.timeout" - cfgKeepalivePermitWithoutStream = "keepalive.permit_without_stream" - // Web. cfgWebReadBufferSize = "web.read_buffer_size" cfgWebWriteBufferSize = "web.write_buffer_size" @@ -130,12 +122,6 @@ func settings() *viper.Viper { v.SetDefault(cfgLoggerSamplingInitial, 1000) v.SetDefault(cfgLoggerSamplingThereafter, 1000) - // keepalive: - // If set below 10s, a minimum value of 10s will be used instead. - v.SetDefault(cfgKeepaliveTime, defaultKeepaliveTime) - v.SetDefault(cfgKeepaliveTimeout, defaultKeepaliveTimeout) - v.SetDefault(cfgKeepalivePermitWithoutStream, true) - // web-server: v.SetDefault(cfgWebReadBufferSize, 4096) v.SetDefault(cfgWebWriteBufferSize, 4096)