Skip to content

Commit

Permalink
[ycabled][grpc] Fix some time interval,options for grpc keep alive to…
Browse files Browse the repository at this point in the history
… work (#271)

This PR is meant to fix gRPC keepalive timeout values. With this change and adding the options to server side, the pings start working for TCP connection for all gRPC channels. This PR is also meant to increase the time intervals between pings to 4 seconds for gRPC connections
With this change the TCP connections are always persistent
example:

admin@sonic:~$ netstat | grep 50075
tcp6       0      0 tmg.dtap.sphybrid:41828 vlan2003.mim-a75s:50075 ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43912 192.168.0.3:50075       ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43620 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:37768       192.168.0.23:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:58776 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:34634       192.168.0.21:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:47672 win-cfr7mesbc6v.c:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:42318       192.168.0.7:50075       ESTABLISHED
tcp6       0      0 192.168.0.1:48792       co1speutlv104.phx:50075 ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:34794 dtap15.dtap.sphyb:50075 ESTABLISHED
tcp6       0      0 192.168.0.1:56194       192.168.0.13:50075      ESTABLISHED
tcp6       0      0 tmg.dtap.sphybrid:43548 win-cfr7mesbc6v.c:50075 ESTABLISHED


Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
  • Loading branch information
vdahiya12 authored Jul 6, 2022
1 parent 1651050 commit e889625
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,10 @@ def setup_grpc_channel_for_port(port, soc_ip):

retries = 3
for _ in range(retries):
channel = grpc.insecure_channel("{}:{}".format(soc_ip, GRPC_PORT), options=[('grpc.keepalive_timeout_ms', 2000),
('grpc.keepalive_time_ms', 1000),
channel = grpc.insecure_channel("{}:{}".format(soc_ip, GRPC_PORT), options=[('grpc.keepalive_timeout_ms', 8000),
('grpc.keepalive_time_ms', 4000),
('grpc.keepalive_permit_without_calls', True),
('grpc.http2.max_pings_without_data', 0),
('grpc.http2.min_time_between_pings_ms', 2000),
('grpc.http2.min_ping_interval_without_data_ms', 1000)])
('grpc.http2.max_pings_without_data', 0)])
stub = linkmgr_grpc_driver_pb2_grpc.DualToRActiveStub(channel)

channel_ready = grpc.channel_ready_future(channel)
Expand Down

0 comments on commit e889625

Please sign in to comment.