Is grpc keepalive supported ?

Maxim Dounin mdounin at mdounin.ru
Sat Mar 31 22:25:21 UTC 2018


Hello!

On Sat, Mar 31, 2018 at 06:36:35AM -0400, bcoz123 wrote:

> Hello everyone,
> In the latest version(1.13.10)
> Does ‘grpc_pass’ support the ‘keepalive’ option ?
> My configuration is:
> 
> ...
> http {
>     ...
>     upstream backend {
>         server localhost:50051;
>         keepalive 300;
>     }
>     server {
>         listen 80 http2;
>         location / {
>             grpc_pass grpc://backend;
>        }
>     ...
> }
> ...
> 
> It seems not work,
> Because I can still see for every request from the front, 
> Nginx create a new tcp connection between nginx and backend every time.
> Is there something wrong in my configuration file?
> Or just it is not supported in this version ?

It is supported, though connections may still be closed in some 
specific cases (unlikely to occur with valid gRPC requests 
though).  Note well that keepalive connection caches are 
per-worker, so if you are using multiple worker processes you may 
need to do multiple tests to see it working.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx mailing list