Skip to content

Commit

Permalink
set new default KeepAlive configurations
Browse files Browse the repository at this point in the history
Summary:
In this diff, we tune the default keep alive parameter to be the following

```
-Dthrift.rsocket-keep-alive-ms=30000
-Dthrift.rsocket-keep-max-lifetime-ms=3600000
```

Reviewed By: prakashgayasen

Differential Revision: D54496796

fbshipit-source-id: e921d409d5bc01fbcd0f328934fba25cad12fd3c
  • Loading branch information
avalonalex authored and facebook-github-bot committed Mar 30, 2024
1 parent 519f00b commit f80363c
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ public class RSocketRpcClientFactory implements RpcClientFactory {
System.getProperty(
"thrift.rsocket-max-frame-size", String.valueOf(FrameLengthCodec.FRAME_LENGTH_MASK)));

// NOTE: KeepAlive is part of the RSocket Protocols, it is a way of maintaining connections and
// detecting broken connections (such as half open connection).
//
// How KeepAlive works:
// * Client periodically pings the server with KeepAliveFrame, server returns ACK immediately.
// * Client periodically checks received ACKs.
// * If client do not receive KeepAlive ACK after the configured max lifetime, the client closes
// the connection.
//
// KeepAlive Configurations:
// thrift.rsocket-keep-alive-ms (or KEEP_ALIVE): the interval of client KeepAlive ping.
// thrift.rsocket-keep-max-lifetime-ms (or KEEP_ALIVE_MAX_LIFETIME): time window when client
// checks ACKs. During the time window, if no ACK was received, client will close the connection.
private static final int KEEP_ALIVE =
Integer.parseInt(System.getProperty("thrift.rsocket-keep-alive-ms", String.valueOf(-1)));
Integer.parseInt(System.getProperty("thrift.rsocket-keep-alive-ms", String.valueOf(30000)));

private static final int KEEP_ALIVE_MAX_LIFETIME =
Integer.parseInt(
System.getProperty("thrift.rsocket-keep-max-lifetime-ms", String.valueOf(-1)));
System.getProperty("thrift.rsocket-keep-max-lifetime-ms", String.valueOf(3600000)));

static {
ReactorHooks.init();
Expand Down

0 comments on commit f80363c

Please # to comment.