Projects tigase _server server-core Issues #1542
Add option to configure Socket TCP KeepAlive settings (#1542)
Andrzej Wójcik (Tigase) opened 3 months ago

According to the answer as StackOverflow, since JDK 11 it is possible to configure Socket TCP keep alive settings.

We do recommend configuring those on the operating system level for best results, but it would be good to allow configuring that within Tigase XMPP Server, so that just for Tigase XMPP connections would be configured to use those settings and it would not have any impact on other applications running on the same server. That would be very desirable, ie. for Tigase XMPP Server deployed on a Kubernetes cluster.

wojciech.kapcia@tigase.net commented 3 months ago

For posterity:

Javadoc: https://docs.oracle.com/en/java/javase/21/docs/api/jdk.net/jdk/net/ExtendedSocketOptions.html

Example:

Socket socket = new Socket();
socket.setOption(ExtendedSocketOptions.TCP_KEEPIDLE, 10);
socket.setOption(ExtendedSocketOptions.TCP_KEEPCOUNT, 2);
socket.setOption(ExtendedSocketOptions.TCP_KEEPINTERVAL, 3);
wojciech.kapcia@tigase.net added "Related" tigase/helm-charts#3 3 months ago
wojciech.kapcia@tigase.net added "Related" tigase/_server/tigase-server#25 3 months ago
wojciech.kapcia@tigase.net changed state to 'In Progress' 3 months ago
Previous Value Current Value
Open
In Progress
Referenced from commit 3 months ago
wojciech.kapcia@tigase.net changed state to 'In QA' 3 months ago
Previous Value Current Value
In Progress
In QA
wojciech.kapcia@tigase.net commented 3 months ago

Added the configuration. @andrzej.wojcik - what do you think?

@kobit @andrzej.wojcik I was pondering if we should adjust watchdog settings and decrease interval/timeout as that would significantly speed up detection of broken connections, and in today's world most of the deployments are oriented toward mobile users. The downside is of course higher impact on the server, but for c2s we could stick with whitespace ping still.

Referenced from commit 3 months ago
wojciech.kapcia@tigase.net commented 3 months ago

Updated base docker image as the functionality requires jdk.net module, which we didn't have in jlink…:

xmpp-1  | [2024-09-24 15:49:26:657] [SEVERE  ] [  ConnectionOpenThread ] ThreadExceptionHandler.uncaughtException(): Uncaught thread: "ConnectionOpenThread" exception
xmpp-1  | java.lang.NoClassDefFoundError: jdk/net/ExtendedSocketOptions
xmpp-1  | 	at tigase.io.SocketIO.<init>(SocketIO.java:75)
xmpp-1  | 	at tigase.net.IOService.accept(IOService.java:168)
xmpp-1  | 	at tigase.server.ConnectionManager$ConnectionListenerImpl.accept(ConnectionManager.java:1256)
xmpp-1  | 	at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java:179)
xmpp-1  | 	at java.base/java.lang.Thread.run(Unknown Source)
xmpp-1  | Caused by: java.lang.ClassNotFoundException: jdk.net.ExtendedSocketOptions
xmpp-1  | 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
xmpp-1  | 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
xmpp-1  | 	at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
xmpp-1  | 	... 5 more
Referenced from commit 1 month ago
Merge branch 'master' into jdk7
# By Wojciech Kapcia (4) and others
* master:
  Fixes #1542, #1475 by forcing delivery of resent unacked packets on stream resumption and by correcting settings resumption-timeout property key
  Bug #1538: Exception in Sasl Authentication when do Load Test Tigase Server with TSung
  add support for MS SQL Server to Tigase XMPP Server; #1461: SQL Server Support - code development
  Revert "move dependencies to master project"
  fix distribution building on windows
  move dependencies to master project
Andrzej Wójcik committed 1 decade ago
Referenced from commit 1 month ago
Please wait...
Page is in error, reload to recover