Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Optimal JDBC connection pooling configuration for tomcat server

 
jay desi
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34681
367
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
Eduardo Bueno
Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic