Home NewsX Lesson Learned #509: KeepAliveTime parameter in HikariCP

Lesson Learned #509: KeepAliveTime parameter in HikariCP

by info.odysseyx@gmail.com
0 comment 8 views


Using network tracing, I observed that once a connection is established, the operating system sends TCP keepalives to keep it alive. This indicates how often the connection is checked to see if it remains active in the HikariCP connection pool.

Jose_Manuel_Jurado_0-1727441449080.png

In this situation, my first idea for idle connections in the HikariCP pool was to configure the KeepAliveTime parameter. HikariCP sends a simple query (e.g. SELECT 1) to idle connections that have been inactive for longer than the value of this parameter. This will maintain the connection and prevent unexpected disconnection by external systems.

You can view the results in the following network traces and SQL Profiler:

Jose_Manuel_Jurado_1-1727441716418.png

Jose_Manuel_Jurado_2-1727441756434.png

Network settings related to firewalls have policies that close idle connections after a certain period of time. In this way, if a connection is closed and no keepalivetime is set, HikariCP will only detect the closure when the connection is requested from the pool.

take pleasure in!





Source link

You may also like

Leave a Comment

Our Company

Welcome to OdysseyX, your one-stop destination for the latest news and opportunities across various domains.

Newsletter

Subscribe my Newsletter for new blog posts, tips & new photos. Let's stay updated!

Laest News

@2024 – All Right Reserved. Designed and Developed by OdysseyX