grpc keepalive does not effect, nginx will close connection by the minute
Sergey Kandaurov
pluknet at nginx.com
Tue Jan 22 12:01:29 UTC 2019
> On 22 Jan 2019, at 06:43, Roar <nginx-forum at forum.nginx.org> wrote:
>
> Grpc server is sitting at my backends, I use nginx as the proxy to transfer
> http1.1 to http2(grpc) protocol, I set parameter like below:
>
> upstream ID_PUMPER {
> server 127.0.0.1:58548;
> }
>
> server {
> listen 8080 http2;
> grpc_read_timeout 120s;
> grpc_send_timeout 120s;
> grpc_socket_keepalive on;
> keepalive_timeout 100s;
>
> location /utoProto.idProduce.IdProduce {
> grpc_pass grpc://ID_PUMPER;
> }
> }
>
> It will establish connection between nginx and grpc server, but it can not
> hold the connection and the collection will be closed after one minute even
> though I set keepalive_timeout parameter
To tune keepalive timeout to upstream connections,
you need the keepalive_timeout directive of the upstream module,
that is, specified in the upstream{} block. See for details:
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout
--
Sergey Kandaurov
More information about the nginx
mailing list