object pool vs connection pool -
what exact difference between object pool , connection pool? there difference in algorithm utilizing memory. msdn says "object pooling lets control number of connections use, opposed connection pooling, control maximum number reached." mean?
please me clarify above.
a connection pool object pool contains connection objects.
"object pooling lets control number of connections use, opposed connection pooling, control maximum number reached."
an object pool allows application limit number of instances in use @ 1 time. if application needs more instances limit, object pool has decide how deal problem. there number of possible strategies:
- return null
- throw exception
- block until instance available
- increase size of pool
a connection pool object pool, has same decision make.
a specific implementation of object pool (or connection pool) use 1 of these strategies, or several in combination.
in opinion statement quoted misleading unless talking specific implementations.
a simple object pool example
a pool has configuration parameters. simple pool might have minimum_size , maximum_size. when pool first available use contain minimum_size objects. clients ask these objects, pool contain fewer unallocated objects. number can increase when clients return objects pool.
at point pool might reach state has no unallocated objects, 1 or more clients requests object. @ point, long pool hasn't reached maximum_size, can create new objects , add them pool. can return objects clients.
if pool has reached maximum_size, cannot increase size of pool, has deal clients in different way - let's throws objectpoolexhausted exception.
a little while later, clients return objects pool, , can carry on usual until runs out of objects again.
back question
the msdn article saying specific object pool implementation increase size of pool specified maximum. when maximum reached, unlike example above, instead of throwing exception, makes client wait until object returned pool, , gives newly returned object waiting client.
the msdn article says specific connection pool implementation not have maximum size parameter - keep creating new connections meet demand (eventually hit system limit , request fail in way isn't specified).
Comments
Post a Comment