This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Optimal JDBC connection pooling configuration for tomcat server

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have below mentioned configuration for connection pooling on tomcat server 6.0.20:-



Issue here is, that as day passes by, same query that takes about 12-14 seconds to execute in morning takes about 50-70 seconds later in the day...after say 2-3 hours..
And performance degrades further on..I am sure, something is wrong in my connection pooling configuration in server.xml file.

I am not using hibernate or other ORM frameworks.

Pl let me know how do I optimize this configuration.
 
author & internet detective
Posts: 40797
829
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jay,
Are you sure you are closing the connection always and in a finally block? This sounds like a connection leak.
 
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have crossContext declared as true; are you really using it?

There is nothing wrong in your context. Your problem is not in it.
 
jay desi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use below procedure for closing connections:-

I have a separate class ConnectionUtils that deals with connections, which contains different methods like


Then in my other classes I have methods in following manner:-


So, I do not essentially close connections in finally block, but in try block and set references to null in finally block.
Is this not a good approach?
 
jay desi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jeanne/Eduardo .. is the above mentioned way of closing connections appropriate way?
 
jay desi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I logged in messages like :-

I added these messages in respective separate "close" methods..And found that
for each query that is executed, these messages were written to log file...So, I guess
connections leak is not taking place...

Is there any other way where we can find if any connections/statements/resultsets are still
open?
reply
    Bookmark Topic Watch Topic
  • New Topic