Jetty embedded with different behavior for persistent connection on two Linux systems

443 Views Asked by At

I am testing a Jetty embedded server (similar to jersey-http2-jetty-bundle) called by a Jersey HTTP/1.1 (HttpURLConnection) client on two different servers.

  1. Linux amss1 4.9.125-linuxkit #1 SMP Fri Sep 7 08:20:28 UTC 2018 x86_64 GNU/Linux
  2. Linux amss2 3.10.0-957.el7.x86_64 #1 SMP Thu Oct 4 20:48:51 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

On the first one, the TCP connection is persistent, i.e. it is reused for several calls and on the second one the TCP connection is directly closed.

Is there a configuration at OS level that can change the TCP persistent behavior so that the second server is re-using TCP connection?

I'm checking if the TCP connection is kept with netstat -anp | grep java | grep 'otherServerIp' from client and server side.

The following configuration is defined on the second server.

$ grep 'net.ipv4.tcp_keepaliv' /etc/sysctl.conf
net.ipv4.tcp_keepalive_time=600

tcpdump on the second server. tcpdump

0

There are 0 best solutions below