vert.x icon indicating copy to clipboard operation
vert.x copied to clipboard

Configurable socket keep alive interval

Open aksabg opened this issue 2 years ago • 11 comments

NetServer now supports tcpKeepAlive flag which is translated to Netty's SO_KEEPALIVE flag. However, the keepalive interval, idle time and count cannot be set through settings, which means it defaults to OS values (usually the idle time is 2 hours).

When using NetServer in conjuction with the AWS load balancer, the connections are closed when idle for more than 350 seconds.

The following Netty fields should be supported in NetServerOptions:

  1. TCP_KEEPIDLE
  2. TCP_KEEPINTVL
  3. TCP_KEEPCNT

Reference: https://github.com/reactor/reactor-netty/issues/2167

aksabg avatar Mar 22 '24 11:03 aksabg

@vietj I can add this feature, just need the permission to branch.

aksabg avatar Mar 22 '24 14:03 aksabg

@aksabg please contribute it via a pull request

vietj avatar Mar 27 '24 13:03 vietj

@vietj I don't have permissions to create a remote branch required for a pull request.

aksabg avatar Mar 27 '24 14:03 aksabg

@vietj any chance to get this merged? This is a PITA to configure externally on Kubernetes < 1.29 where configuring these defaults via sysctl is considered unsafe.

jakub-id avatar Jun 29 '24 12:06 jakub-id

@vietj Please review this. It's essential that those options can be configured from the code as Linux defaults are completely unusable. For comparison Go not only allows controlling this (https://pkg.go.dev/net#KeepAliveConfig) but also enables TCP keepalive by default with idle=15s, interval=15s and count=9 settings which are much more sensible than the defaults.

jakub-id avatar Sep 10 '24 14:09 jakub-id

@jakub-id the issue is that the PR does not have an eclipse agreement signed

vietj avatar Sep 11 '24 06:09 vietj

@vietj I saw that but the Eclipse report is weird as her email is mentioned once in the green box and three times in the red box. Unless it's a different email but it doesn't look like it.

jakub-id avatar Sep 11 '24 08:09 jakub-id

@vietj @jakub-id I have signed the agreement (https://accounts.eclipse.org/users/vealrad) Is there anything else I need to do?

aksabg avatar Sep 11 '24 09:09 aksabg

@aksabg Great! Can you remove the JavaDoc formatting changes and empty new lines as @vietj asked on the PR?

jakub-id avatar Sep 17 '24 06:09 jakub-id

where is the PR ?

vietj avatar Sep 17 '24 07:09 vietj

@vietj https://github.com/eclipse-vertx/vert.x/pull/5183

aksabg avatar Sep 17 '24 07:09 aksabg