Welcome! Log In Create A New Profile

Advanced

Is grpc keepalive supported ?

Posted by bcoz123 
bcoz123
Is grpc keepalive supported ?
March 31, 2018 12:40PM
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 ?

Thanks

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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Maxim Dounin
Re: Is grpc keepalive supported ?
April 01, 2018 12:30AM
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/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
bcoz123
Re: Is grpc keepalive supported ?
April 02, 2018 09:50AM
Thanks, Maxim,
I have another question,
If there are multiple grpc clients in the front,
Does nginx reuse the same connection to the backend grpc server?
By my test, it seems not.
In my opinion, http2 can support that.
And it can save resourses by avoid creating new tcp connection for each grpc
request,
Will you plan to support that in the future ?
Thanks

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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Maxim Dounin
Re: Is grpc keepalive supported ?
April 02, 2018 03:00PM
Hello!

On Mon, Apr 02, 2018 at 03:47:12AM -0400, bcoz123 wrote:

> If there are multiple grpc clients in the front,
> Does nginx reuse the same connection to the backend grpc server?
> By my test, it seems not.
> In my opinion, http2 can support that.
> And it can save resourses by avoid creating new tcp connection for each grpc
> request,
> Will you plan to support that in the future ?

Connections to backend grpc servers are not bound to particular
clients, and if there are cached keepalive connections, they will
be used for any client request.

We don't try to multiplex serveral requests within a single
backend connection though. There are no plans to support this.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
bcoz123
Re: Is grpc keepalive supported ?
April 03, 2018 01:00PM
Thanks,Maxim
Have a nice day

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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login