keepalive not work with grpc

hunterqin nginx-forum at forum.nginx.org
Mon Aug 6 03:21:06 UTC 2018


Hi, everyone! I have a problem that keepalive does not work with grpc.
My conf looks like this:

worker_processes  1;

events {
    worker_connections  102400;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;
    keepalive_requests 1000;

    upstream grpc_backend {
            server localhost:2080;
            keepalive 2;
    }
    ...
    server {
            listen       1090     http2;
            server_name  localhost;
            ...

            location / {
                grpc_pass grpc://grpc_backend;
            }
    }
}
I have a C++ gprc client and C++ grpc server that works well together
without nginx.
It seems like that nginx does not support the keepalive with grpc_pass at
all. There are still so many connections built from nginx to grpc server
that all my ports are consumed. I remember that nginx does support that, so
how could it work? Where is my mistake?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,280765,280765#msg-280765



More information about the nginx mailing list