Skip to content

Commit e889625

Browse files
authored
[ycabled][grpc] Fix some time interval,options for grpc keep alive to 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 <[email protected]>
1 parent 1651050 commit e889625

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

sonic-ycabled/ycable/ycable_utilities/y_cable_helper.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -383,12 +383,10 @@ def setup_grpc_channel_for_port(port, soc_ip):
383383

384384
retries = 3
385385
for _ in range(retries):
386-
channel = grpc.insecure_channel("{}:{}".format(soc_ip, GRPC_PORT), options=[('grpc.keepalive_timeout_ms', 2000),
387-
('grpc.keepalive_time_ms', 1000),
386+
channel = grpc.insecure_channel("{}:{}".format(soc_ip, GRPC_PORT), options=[('grpc.keepalive_timeout_ms', 8000),
387+
('grpc.keepalive_time_ms', 4000),
388388
('grpc.keepalive_permit_without_calls', True),
389-
('grpc.http2.max_pings_without_data', 0),
390-
('grpc.http2.min_time_between_pings_ms', 2000),
391-
('grpc.http2.min_ping_interval_without_data_ms', 1000)])
389+
('grpc.http2.max_pings_without_data', 0)])
392390
stub = linkmgr_grpc_driver_pb2_grpc.DualToRActiveStub(channel)
393391

394392
channel_ready = grpc.channel_ready_future(channel)

0 commit comments

Comments
 (0)