How To
ForgeRock Identity Platform
Does not apply to Identity Cloud

How do I implement keep-alive functionality for the managed repository in IDM (All versions)?

Last updated Apr 8, 2021

The purpose of this article is to provide information on implementing keep-alive functionality for the managed repository in IDM to prevent issues when idle connections are closed by the network infrastructure. This configuration applies when you are using a JDBC database.

2 readers recommend this article

Implementing keep-alive functionality

IDM uses the Hikari connection pool by default. See Object Modeling Guide › JDBC Connection Configuration and Hikari Project Page for further information on configuring the connection pool settings.

You cannot configure keep-alive functionality within Hikari; however, if you do require keep-alive functionality, you can set the TCP keep alive instead using the mechanism provided by the JDBC datasource. Both MySQL™ and PostgreSQL® provide a tcpKeepAlive configuration property, which can be added to the datasource.jdbc-default.json file (located in the /path/to/idm/conf directory), for example:

{    "driverClass" : "org.postgresql.Driver",     "jdbcUrl" : "jdbc:postgresql://&{}:&{openidm.repo.port}/openidm",     "databaseName" : "openidm",     "username" : "openidm",     "password" : "openidm",     "connectionTimeout" : 30000,     "connectionPool" : {         "type" : "hikari",         "minimumIdle" : 20,         "maximumPoolSize" : 50     },     "tcpKeepAlive" : "true" }

When set to true, connections in the Hikari connection pool are tested when they are retrieved using the JDBC Connections isValid() method to ensure that a closed connection is never returned.

Verifying the keep-alive changes

You can make use of any Network Traffic Analyzer (such as Wireshark) or simply output a tcpdump on the IDM server to check that the JDBC Connections driver is invoking the isValid() method.

See Also

 Object Modeling Guide › JDBC Connection Configuration 

Hikari Project Page 

Related Training


Related Issue Tracker IDs


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.