[CONJ-831] allow setup of TCP_KEEPIDLE, TCP_KEEPCOUNT, TCP_KEEPINTERVAL in the jdbc url Created: 2020-09-17  Updated: 2021-04-23  Resolved: 2021-04-23

Status: Closed
Project: MariaDB Connector/J
Component/s: configuration
Affects Version/s: None
Fix Version/s: 3.0.0

Type: New Feature Priority: Major
Reporter: Cyrille Mastchenko Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None
Environment:

docker linux into aws ECS connecting to AWS Aurora mysql cluster



 Description   

Hi, we use liquibase and mariadb jconnector to update our schema in Aurora Mysql.
We found that the 'cluster' address of Aurora is hiding a NAT that kill connection after 5mn if there is no data.
Some of our schema change (alter table ...) take more than 5mn, so the alter table run in aurora but liquibase/mariadb see a connection lost after 5mn.

One easy solution is to generate tcp keepalive packet, I was able to make it work on my laptop running the docker image with privileges and using sysctl to change the linux tcp keepalive interval to less than 5mn.

Sadly in our ECS cluster, we don't have privileges to change the linux tcp keepalive interval (it is a host base settings).

Linux allow you to setup per connection the value, they are part of the ExtendedSocketOptions in recent java version.
It would be nice to be able to setup those values the same way we enable tcpkeepalive in the jdbc url.
That would allow our liquibase container and our main java application to be able to run query/schema change that take more than 5mn without getting disconnected.

AWS Aurora mysql doesn't seems to allow settings on the server side.
The default linux 2hours tcp keepalive is far too long here.

(those value can also be setup at low value automatically when we use jdbc:mariadb:aurora url prefix)



 Comments   
Comment by Diego Dupin [ 2020-09-18 ]

that make sense, but will be available only with 3.x release, since it will require java 11 minimum version

Comment by Cyrille Mastchenko [ 2020-09-18 ]

Thanks for the answer, what is the ETA for 3.0.0 ?

Comment by Diego Dupin [ 2021-04-23 ]

New option `tcpKeepIdle`, `tcpKeepCount`, `tcpKeepInterval` added in 3.0.0 version.

Implementation use Multi-Release JARs (MRJAR), to simultaneously contain implementations for java 8 and java 11+ (so even if options are enable on java 8, they won't have any effect)

Generated at Thu Feb 08 03:18:38 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.