Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pooling

 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to develop a web allpication .

What are the benefits of pooling?

what happens if we dont use a pooling in a web based application?

if a pooling is a logic of one connection for one user
what happens if two user uses same connection instance?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The benefit is avoiding the overhead of opening connections, which are network operations nad potentially time- and resource-consuming.

If you don't use them, you don't get that benefit. And since all serious JDBC drivers come with pooling built-in these days, there's very little work required in using them. Your logic will need to ensure that you return connections to the pool once you're done with them, of course.

Pooling does not mean "one user - one connection", but potentially "many users - one connection". Connections would not be used simultaneously by two users. One user would get a connection from the pool, use it, and then return it to the pool. It would be a bad thing if two users would use the same connection at the same time, possibly even within transactions.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sinasi susam:
what happens if two user uses same connection instance?


Nothing, all would be fine. Unless they use it simultaneously.
 
sinasi susam
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can realize that it will be problem when rolling back with the method of Connection class.

if our jobs were not transactional so there will not be problem right?

How many statements can we create from a connection?
Can we create how much we want?Is it up to us or its limited?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create as many statements through a connection as you like, though not simultaneously, only in succession. And it doesn't matter if they're made by different users, as long as they're not transactional.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic