No ManagedConnections - Steps to increase pool size

No ManagedConnections - Steps to increase pool size

From the logs we were able to identify the error trace as [org.apache.catalina.authenticator.NMSFormAuthenticator]|[WARNING]|[68]|: Unexpected error while forwarding to login page : {0}|javax.servlet.ServletException: org.jboss.util.NestedSQLException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ); - nested throwable: (javax.resource.ResourceException: No ManagedConnections available within configured blocking timeout ( 30000 [ms] ))"

If the server / client is non-responsive, there could be multiple reasons. however unavailability of the DB connections mostly the culprit. 

Possible errors that can be found in serverout*.txt file will be

No Managed Connection available. 

Interrupted while requesting permit. 

* This could happen in a scenario where you have more than 100 users accessing in a given time, 

For this, edit the file 'mysql-ds.xml' (for mysql) / 'mssql-ds.xml' (for mssql) using a text editor (Notepad / VI) found under \\Manageengine\\SupportCenter\\server\\default\\deploy  and append the following parameters depending upon number of concurrent users, before, </local-tx-datasource>


For more than 200 users, 

 <min-pool-size>5</min-pool-size>
<max-pool-size>219</max-pool-size>
<idle-timeout-minutes>1</idle-timeout-minutes>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<blocking-timeout-millis>20000</blocking-timeout-millis>
<prepared-statement-cache-size>30</prepared-statement-cache-size>

Less than 200 users, 

<idle-timeout-minutes>1</idle-timeout-minutes>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<blocking-timeout-millis>20000</blocking-timeout-millis>
<prepared-statement-cache-size>30</prepared-statement-cache-size>

* Application restart is required for changes to take effect. 


For reference, here is the brief explanation of these parameters, 

min-pool-size and max-pool-size : 

By default we will have 20 connections pools, these parameters would increase the number of ​connections to 219, this would impact the performance of the application only if you have MSSQL installed on a very high configuration server (>10 Gb of RAM). If it is less(<= 4 gb of RAM) then increasing connections would make heavy load to the MSSQL server and it will become almost non-responsive and hang the application.

idle-timeout-minutes : By default it will be 15 mins. Since it is set to 1 min the unused connections would return to the pool and it will decrease the number of active connections to the Mssql.

check-valid-connection-sql : 

This would have our application will to validate the connection whenever it returns from the pool which means, if the connection is forcibly closed by the database server, this tells the Jboss to discard the connection and create a new one

prepared-statement-cache-size : 

the number of prepared statements per connection to be kept open and reused in subsequent requests. The default is 0 (zero), meaning no cache.