What factors should be taken into consideration when setting a value for background-validation-millis parameter in JBoss EAP 5.x/6.x
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.x
Issue
- What is the default value for
<background-validation-millis>parameter in the data source configuration settings? - What factors should be taken into consideration when setting a value for
<background-validation-millis>parameter?
Resolution
The default value for <background-validation-millis> parameter is 0 milliseconds[1]. This also implies background validation is disabled. This value should not be the same as your <idle-timeout-minutes> value. Please also refer to this document [2] for more information.
The main consideration when setting <background-validation-millis> is that the lower the value the more often the pool will be validated which will take up more database resources. Also the lower the value the sooner invalid connections will be evicted from the pool. On one hand too low of an value (meaning validation is occurring too often) can stress the connection pool resources. On the other hand, if the value is set too high (meaning validation is not occurring frequently enough) then the dead connections will go undetected for longer periods. Therefore it is a balancing act to determine the correct value for a particular system.
If the minimal performance hit is not a concern then using <validate-on-match> is a safer approach than <background-validation-millis>. These articles [3] and [4] elaborate on this topic.
References:
JON 2.3 Managed Resources Guide - 2.4.10. Local Tx Datasource Service
This content is not included.This content is not included.https://access.redhat.com/knowledge/docs/en-US/JBoss_Operations_Network/2.3/html/Managed_Resources_Guide/Local_Tx_Datasource_Service.html
2: EAP 5 Administration and Configuration Guide - 15.2. Datasource Parameters
This content is not included.This content is not included.https://access.redhat.com/site/documentation/en-US/JBoss_Enterprise_Application_Platform/5/html/Administration_And_Configuration_Guide/ch17s02.html
3: JBoss process hangs attempting to get a new connection from Oracle
https://access.redhat.com/knowledge/solutions/18602
4: JDBC datasource not fault tolerant in JBoss and needs connection validation enabled
https://access.redhat.com/knowledge/solutions/19286
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.