title: Ideal background-validation-millis value for Pool size about 50
body: <p>We are using jboss enterprise application server 5.x for our application<br>
  Also we are using jboss datasource <code>*-ds.xml</code> to have a connection pool.<br>
  Below is the datasource xml file <br></p>
  
  <pre><code>&lt;datasources&gt;
          &lt;local-tx-datasource&gt;
                  &lt;jndi-name&gt;myappDS&lt;/jndi-name&gt;
                  &lt;connection-url&gt;jdbc:oracle:thin:@ip:1521:sid&lt;/connection-url&gt;
                  &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;
                  &lt;user-name&gt;usr&lt;/user-name&gt;
                  &lt;password&gt;pass&lt;/password&gt;
                  &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;
                  &lt;max-pool-size&gt;50&lt;/max-pool-size&gt;
                  &lt;blocking-timeout-millis&gt;5000&lt;/blocking-timeout-millis&gt;
                  &lt;idle-timeout-minutes&gt;15&lt;/idle-timeout-minutes&gt;
                  &lt;autoReconnect&gt;true&lt;/autoReconnect&gt;
                  &lt;failOverReadOnly&gt;false&lt;/failOverReadOnly&gt;
                  &lt;maxReconnects&gt;50&lt;/maxReconnects&gt;
                  &lt;initialTimeout&gt;15&lt;/initialTimeout&gt; 
                  &lt;check-valid-connection-sql&gt;select 1 from dual&lt;/check-valid-connection-sql&gt;
                  &lt;background-validation-millis&gt;150000&lt;/background-validation-millis&gt;
                  &lt;validate-on-match&gt;false&lt;/validate-on-match&gt;
                  &lt;!--
                          corresponding type-mapping in the standardjbosscmp-jdbc.xml
                          (optional)
                  --&gt;
                  &lt;metadata&gt;
                          &lt;type-mapping&gt;Oracle11g&lt;/type-mapping&gt;
                  &lt;/metadata&gt;
          &lt;/local-tx-datasource&gt;
  &lt;/datasources&gt;
  </code></pre>
  
  <p>Now here as you see we are using background connection validation using a query.<br>
  My understanding is jboss will try to execute the validation query for each of the connection currently in pool to validate the connections.<br>
  <br> <strong>1.</strong> Is my understanding correct?
  <br> <strong>2.</strong> If yes then what should be the ideal <code>&lt;background-validation-millis&gt;</code> value provided my max pool size is 50 and the db will be restarted only during weekend. We introduced this validation because whenever the DB was <strong>restarted</strong> we had to restart our Jboss server otherwise it was not able to connect automatically to database.<br><br>
  Let me know if the question is not clear.<br>
  Thanks in advance.</p>