|
Replies:
6
-
Last Post:
Sep 26, 2008 2:05 AM
by: sm157516
|
|
|
|
|
|
|
jdbc-connection-pool settings
Posted:
Jun 17, 2008 11:20 AM
|
|
|
Hello,
I've testing my app on both glassfishv2 and glassfishv2ur2 with same results. I've observed that the maxNumConnUsed is always 1. As I understand, maxNumConnUsed is the number of actual connections from pool to the database server. Why is it always 1? How can I increase it!? Please find below the pool configuration options.
config: allow-non-component-callers="true" associate-with-thread="true" connection-creation-retry-attempts="100" connection-creation-retry-interval-in-seconds="5" connection-leak-reclaim="true" connection-leak-timeout-in-seconds="30" connection-validation-method="table" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" fail-all-connections="false" idle-timeout-in-seconds="25200" is-connection-validation-required="true" is-isolation-level-guaranteed="true" lazy-connection-association="true" lazy-connection-enlistment="true" match-connections="true" max-connection-usage-count="1000" max-pool-size="45" max-wait-time-in-millis="60000" name="csp-pool" non-transactional-connections="true" pool-resize-quantity="10" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="25" transaction-isolation-level="read-committed" validate-atmost-once-period-in-seconds="10" validation-table-name="dual" wrap-jdbc-objects="false"
Kind Regards, Sanjeev
|
|
|
|
|
|
|
Re: jdbc-connection-pool settings
Posted:
Jun 17, 2008 7:37 PM
in response to: sanjeev_any
|
|
|
Hi,
Please find below, the statics collected from Pool Monitor.
The things worrying are: maxConnectionRequestWait = 4654 and maxNumConnUsed = 1
Had there been an increase in maxNumConnUsed, I guess, the maxConnectionRequestWait will reduce considerably!??
Monitoring Statistics : PoolCounters: maxNumConnUsed = 1 minNumConnUsed = 0 currNumConnUsed = -77 maxNumConnFree = = 102 minNumConnFree = 24 currNumConnFree = 102 numConnCreated = 45 numConnDestroyed = 0 numConnFailedValidation = 0 numConnTimedOut = 0 numConnAcquired = 120 numConnReleased = 110 currConnectionRequestWait = 1 minConnectionRequestWait = 0 maxConnectionRequestWait = 4654 totalConnectionRequestWait = 15410 numConnSuccessfullyMatched = 118 numConnNotSuccessfullyMatched = 0 numPotentialConnLeak = 0|#]
Hope, someone has some clue of how to optimize these.
Kind Regards, Sanjeev
|
|
|
|
|
|
|
|
|
|
Re: jdbc-connection-pool settings
Posted:
Jun 18, 2008 4:22 AM
in response to: jr158900
|
|
|
Hai,
Oh! Does that mean that its the problem with reporting wrong values!? That disappoints me as I was hoping there'd be a way to increase those connections somehow and then lessen the wait times 
As Hibernate is the one which makes majority of the calls, unfortunately, I didn't have a test case. I will write one and will attach it to the bug along with the log files.
Kind Regards, Sanjeev
|
|
|
|
|
|
|
|
Re: jdbc-connection-pool settings
Posted:
Jun 18, 2008 6:24 AM
in response to: sanjeev_any
|
|
|
Oh, I am not sure then. It is possible that hibernate uses only one connection at any given time. But,
maxConnectionRequestWait = 4654 is fine (4.5 seconds). This particular request may be due to pool initialization (physical connection(s) creation time for steady-pool), so it is fine. totalConnectionRequestWait = 15410 is fine since 120 connections are acquired from pool.
The issue here is : numConnCreated = 45, but maxNumConnFree = 102 and numConnAcquired = 120 numConnReleased = 110, which means currNumConnUsed has to be 10, but currNumConnUsed = -77 (a negative value !)
|
|
|
|
|
|
|
|
Re: jdbc-connection-pool settings
Posted:
Jun 18, 2008 10:57 AM
in response to: jr158900
|
|
|
Hi,
Thank you very much for the update. That is very informative. I have just created a small test case and filed it on the referenced bug list along with the log files. Hope they will be helpful.
And as you have guessed, looks like hibernate is using only one connection. In the above test case, I found that pool is taking full connections. I need to look into hibernate docs for this.
In the recent past I remember seeing negative values more frequently for some of the options. However, in the test case, I see it occassionally for only currNumConnUsed :?
Kind Regards, Sanjeev
|
|
|
|
|
|
|
|
Re: jdbc-connection-pool settings
Posted:
Sep 26, 2008 2:05 AM
in response to: sanjeev_any
|
|
|
This is a bug with the AssocWithThreadResourcePool. Whenever a connection is got, the numConnUsed variable need to be incremented which is not done. Since a decrement is done for every connection closed without an increment, negative values are observed for this variable consistently.
Sometimes, the numConnUsed's negative value could be equal to the number of times the same connection is reused by the thread before it is destroyed, since the connection is associated with the thread.
This has been fixed as part of the issue 5129 : https://glassfish.dev.java.net/issues/show_bug.cgi?id=5129.
Thanks, Shalini.
|
|
|
|
|