users@glassfish.java.net

Re: COnnection Pool Datasource from Glassfish

From: Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM>
Date: Wed, 26 Mar 2008 11:22:36 -0700

> 1. what are the ideal pool tuning numbers ?
It depends on the application's requirements. Default values are for
typical use-cases.
> 2.how do you find out leaked connections are reclaimed ?
Good catch, there is log message indicating that the connection is
leaked but not when the connection is reclaimed.
Please raise a bug.

However, If reclaim was not enabled, pool would have ran out of
connections eventually. So, if you see leak messages in the server.log
and still the pool seems to work fine, reclaim happening.
> Since from the statistics I see the leaked connections number
> should'nt it be zero if it has reclaimed
No, we would prefer to show the leak numbers. This attribute is for
diagnostic purpose. Ideally, application developer need to fix the
application code so that there are no leaks.
> or has the server not reclaimed the leaked connections ?


Thanks,
-Jagadish


On Wed, 2008-03-26 at 07:32 -0800, glassfish_at_javadesktop.org wrote:
> Hi Jagadish,
>
> Just like you mentioned ConnectionPoolDatasource seem to be wrapped up in DataSource type as I lately noticed that my connectionPool reclaimed connections are put back to the pool and using these connections behave as the instances of the connections not physical connections - I tried using CPDS but then it still returned DS type only like mentioned earlier so CPDS type cannot be used directly, so now I have no problem since it gets me the instances and not physical connections by which closing these connections puts it back to the pool and maintains only the minimum physical DB connections set on the server but my pool settings are pointed to CPDS and web.xml refers CPDS I have not pointed to DS type . So in summary these instances got created when the pool was resized in batches of 10 when conn idled out and enabling reclaim leaked connections .
>
> But my concern is
> 1. what are the ideal pool tuning numbers ?
> 2.how do you find out leaked connections are reclaimed ? Since from the statistics I see the leaked connections number should'nt it be zero if it has reclaimed or has the server not reclaimed the leaked connections ?
>
> Monitoring Statistics : PoolCounters: maxNumConnUsed = 15 minNumConnUsed = 0 currNumConnUsed = -44 maxNumConnFree = = 52 minNumConnFree = 0 currNumConnFree = 52 numConnCreated = 1592 numConnDestroyed = 1584 numConnFailedValidation = 0 numConnTimedOut = 0 numConnAcquired = 7502 numConnReleased = 7418 currConnectionRequestWait = 0 minConnectionRequestWait = 0 maxConnectionRequestWait = 1377 totalConnectionRequestWait = 36821 numConnSuccessfullyMatched = 0 numConnNotSuccessfullyMatched = 0 numPotentialConnLeak = 83
> Kuldeep ; Reading your issue I think you might not have set the settings to
> pool resize -10 , Max waittime -60000, leak reclaim-enabled ,Associate with thread - enabled.Try doing this so that you wont have any more physical connections since once the conn are closed it gets released to the pool and there is one more option match connections - try enabling it may be if the transaction runs in the same thread it might pickup the same connection - but I would still watch for the performance as to how it would impact by picking the matched connection means by time wise to check for the thread connections and make sure pool has pointed to CPDS and web.xml referes -CPDS . Just a thought.
>
>
> Thanks ,
> Meena
>
> Meena darly <mdarly7_at_yahoo.com> wrote:
> Hi Jagadish,
>
> Thanks for your email response , since I've been busy could'nt join in the loop though its still on my mind regarding the connection Pool Data source ,for now I need to know what are the best server tuning numbers for maxwait time and Pool resize quantity ? as I see zero max wait time kind of does'nt make much sense like mentioned in the JDBC connection pool settings on the server administration document.
>
> Thanks,
> Meena
>
> Jagadish Prasath Ramu <Jagadish.Ramu_at_Sun.COM> wrote:
> Hi Kuldeep,
>
> Please find my responses in-line.
>
> Thanks,
> -Jagadish
> On Mon, 2008-03-17 at 16:45 -0500, Kuldeep Andhare wrote:
> > HI Jagadish,
> >
> > Thanks for the mail. My requirement is as follows.
> >
> > I am making a call to Store Procedure from my Session Bean. There will
> > be numerous calls made everytime and this will be variable . Like
> > sometimes it will make 100 calls and sometimes more than that. Now my
> > backend procedure is a heavy procedure which typically takes around 20
> > Sec for execution. All this calls needs to be made in parallel. I cant
> > wait for one call to get over to start the other call.
> >
> > Given above requirement it makes sense for me to make use of only one
> > Database Connection and create different Transactions under the same
> > connection. As I dont know total number of calls that are going to be
> > made and also making 100 Connections will have substantial performance
> > problem , I intend to use same connection from Connection Pool.
> As long as you are doing this within a single transaction, you will be
> using same physical connection. (Note : The connection object that you
> (application) gets may look different, but it will internally use single
> physical connection).
> >
> > Now to get the connection from Connection Pool I am making use of
> > Datasource object and calling getconnection method on it. This call
> > creates new connection everytime.
> > So for 100 backend calls this code creates 100 Connections. So
> > definately I am not reusing the same connection from Pool.
> You can confirm whether they are different within a transaction, by,
> typecasting the looked up datasource to com.sun.appserv.jdbc.DataSource,
> then,
> http://docs.sun.com/app/docs/doc/819-3672/beamt?a=view
>
> > Total number of Connections exceeds the max connection count property
> > defined in Connection Pool and hence it is not able to make furthur
> > connections.
> It may be because, application is leaking connections, please enable
> connection leak tracing to figure the issue.
> http://blogs.sun.com/kshitiz/entry/connection_leak_tracing
>
> >
> > Now here i Tried using ConnectionPoolDataSource object and tried using
> > getPooledConnection method on it where I expexct it returns me
> > connection from pool and instead of creating a new Connection. But it
> > my session bean I always get Datasource Object.
> Again, application should not worry about this. Appserver will
> internally use connection pool datasource and provides connections.
> >
> > I am sorry if I am missing something. But was not able to figure it
> > out. Let me know if you guys can throw some light on it. My
> > environment is as follows.
> >
> > App Server: Glassfish V2ur1
> > Persistance Provider: Toplink
> > DB: Oracle 10G(10.2.0.3)
> >
> > Regards,
> >
> > Kuldeep.
> [Message sent by forum member 'md7777' (md7777)]
>
> http://forums.java.net/jive/thread.jspa?messageID=265950
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>