aspose file tools*
The moose likes JDBC and the fly likes setQueryTimeout(...) and too many threads Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "setQueryTimeout(...) and too many threads" Watch "setQueryTimeout(...) and too many threads" New topic
Author

setQueryTimeout(...) and too many threads

Serkan Demir
Ranch Hand

Joined: Feb 03, 2005
Posts: 61
Hi guys,

We have an online multi-threaded system in which we are responding more than 1500 req/sec by querying an Oracle 9 DB. In order to limit the querying period we have been using setQueryTimeout method of PreparedStatement class. This works fine. But once we have profiled our application and noticed that there were too many threads created and garbaged. Since thread creation is an expensive job, we should take care it.
The problem is for each setQueryTimeout action, driver (ojdbc14.jar) creates a new timer thread. Is there anyone who uses this method such a multi-threaded platform and suffers such a problem? Can jdbc drivers apply thread pooling for such cases? Do you know any alternatives to limit long query waits or drop suspended statements ?

thanks lot,

Serkan Demir
www.serkandemir.com
http://serkandemir.blogspot.com
[ July 21, 2006: Message edited by: Serkan Demir ]

A guy from Turkey<br /><a href="http://blogspot.serkandemir.com" target="_blank" rel="nofollow">http://blogspot.serkandemir.com</a>
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: setQueryTimeout(...) and too many threads