Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to queue request when connection pool gets exhausted

 
s florence
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using Oracle 11g as my db, with Hibernate 4 using c3p0 connection pooling.
I want to queue the requests from the application, when the connection pool gets exhausted of connection.
I am increasing the size, but still wants to implement queue, when the connection pool gets exhausted.
programming language java.
Web server - Tomcat

Any help to implement queue is very much appreciated.

Thanks,
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My first reaction: why do you want to queue connection pool requests? It's one of the advantages of using a connection pool, you don't have to care about the management of connections. And a connection pool also improves the performance of your application. Adding a queue for connection pool requests requires code to make your queue thread safe. And thread-safe code is hard to write and always has a (very) slight performance hit.
 
s florence
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the client wants to queue the pending database operations.

Thanks,
florence
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s florence wrote:Because the client wants to queue the pending database operations.

How big is your pool? And how many concurrent connections you have/need?
 
s florence
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we have set max pool sixe to be 300 and increment by 3 when the pool gets exhausted.

regarding concurrent requests, I am not sure. Will you please tell me how to find the concurrent requests.

thanks,
florence
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s florence wrote:we have set max pool sixe to be 300 and increment by 3 when the pool gets exhausted.

So you want to dynamically extend the current connection pool? That's something totally different than your initial question.

s florence wrote:regarding concurrent requests, I am not sure. Will you please tell me how to find the concurrent requests.

You probably have an idea about how many users will concurrently use your application and how many database requests are required. This could give an indication about the number of concurrent requests. That's one of the reasons why your queries should finish as soon as possible. If you have a BasicDataSource you can use getNumActive and getNumIdle.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic