Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling connection keepalive? #154

Closed
ntindall opened this issue Jan 12, 2018 · 6 comments
Closed

Enabling connection keepalive? #154

ntindall opened this issue Jan 12, 2018 · 6 comments

Comments

@ntindall
Copy link

I know the grpc-go has support for connection keepalive in the client. Is there anything similar in the grpc-node client (or does it need to be added?).

Asking because searching for "keepalive" in this repository yields nothing and I cannot find any documentation on the matter.

https://github.com/grpc/grpc-go/blob/master/keepalive/keepalive.go#L31

@murgatroid99
Copy link
Member

This implementation has some client configuration options that serve the same purpose. These channel arguments are listed in this header file. The primary relevant keepalive arguments are "grpc.keepalive_time_ms", "grpc.keepalive_timeout_ms", and "grpc.keepalive_permit_without_calls". Some other arguments that may be useful are "grpc.max_connection_idle_ms", "grpc.max_connection_age_ms", "grpc.http2.min_time_between_pings_ms", and "grpc.http2.min_ping_interval_without_data_ms". These arguments are passed in an object in the Client constructor.

@dio
Copy link

dio commented Jan 31, 2018

@murgatroid99 something like:

var client = new services.GreeterClient('localhost:50051',
                                          grpc.credentials.createInsecure(), 
                                         { "grpc.keepalive_timeout_ms": 1500 }
);

?

@ntindall
Copy link
Author

@dio I was able to confirm the above works by enabling grpc debugging environment variables.

https://github.com/grpc/grpc/blob/master/doc/environment_variables.md

@siacomuzzi
Copy link

@murgatroid99 do you know how I can retrieve the default values for the following options?

  • "grpc.keepalive_time_ms"
  • "grpc.keepalive_timeout_ms"
  • "grpc.keepalive_permit_without_calls"
  • "grpc.max_connection_idle_ms
  • "grpc.max_connection_age_ms"
  • "grpc.http2.min_time_between_pings_ms"
  • "grpc.http2.min_ping_interval_without_data_ms"

I'm using grpc@1.8.4

@dio
Copy link

dio commented Feb 6, 2018

Since I'm not aware of handy docs (maybe I'm just not lucky enough to find it), I do search for those keys inside the repo.

@siacomuzzi most of those keys (flags) are defined in https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/grpc_types.h

e.g. for grpc.keepalive_time_ms it is defined as: GRPC_ARG_KEEPALIVE_TIME_MS https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/grpc_types.h#L215-L217

Then you can search it in the repo hehe. For GRPC_ARG_KEEPALIVE_TIME_MS, it is handled in this function: https://github.com/grpc/grpc/blob/master/src/core/ext/transport/chttp2/transport/chttp2_transport.cc#L2525

@nicolasnoble
Copy link
Member

I think this one can be closed.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants