What are object pooling and connection pooling and difference?

Answers were Sorted based on User's Feedback



What are object pooling and connection pooling and difference?..

Answer / prasenjit

Opening a database connection is a resource intensive and
time consuming operation. Connection pooling increases the
performance of Web applications by reusing active database
connections instead of creating a new connection with every
request. Connection pool manager maintains a pool of open
database connections. When a new connection requests come
in, the pool manager checks if the pool contains any unused
connections and returns one if available. If all connections
currently in the pool are busy and the maximum pool size has
not been reached, the new connection is created and added to
the pool. When the pool reaches its maximum size all new
connection requests are being queued up until a connection
in the pool becomes available or the connection attempt
times out.

Object Pool

An Object Pool may be defined as a container of objects that
are ready for use. Lists of ready-to-be-used objects are
contained in this pool. Whenever a new request for an object
creation comes in, the request is served by allocating an
object from the pool. Therefore, it reduces the overhead of
creating and re-creating objects each time an object
creation is required. "An object pool is an object that
holds a list of other objects, ready to make them available
for use (to yet another object, probably). It does the
management work involved, like keeping track of which
objects are currently in use, how many objects the pool
holds, whether this number should be increased."

The biggest advantage of using Object Pooling is that it
minimizes the consumption of memory and the system's
resources by recycling and re-using objects as and when it
is needed and serving the request for new objects from the
pool of ready-to-be-used objects. The objects that the
application
is done with (the objects are no longer needed) are sent
back to the pool rather than destroying them from the memory.

Is This Answer Correct ?    10 Yes 1 No

What are object pooling and connection pooling and difference?..

Answer / ritesh

Object pooling is a COM+ service that enables you to reduce
the overhead of creating each object from scratch. When an
object is activated, it is pulled from the pool. When the
object is deactivated, it is placed back into the pool to
await the next request. You can configure object pooling by
applying the ObjectPoolingAttribute attribute to a class
that derives from the
System.EnterpriseServices.ServicedComponent class.
Object pooling lets you control the number of connections
you use, as opposed to connection pooling, where you
control the maximum number reached.
Following are important differences between object pooling
and connection pooling:
• Creation. When using connection pooling, creation
is on the same thread, so if there is nothing in the pool,
a connection is created on your behalf. With object
pooling, the pool might decide to create a new object.
However, if you have already reached your maximum, it
instead gives you the next available object. This is
crucial behavior when it takes a long time to create an
object, but you do not use it for very long.
• Enforcement of minimums and maximums. This is not
done in connection pooling. The maximum value in object
pooling is very important when trying to scale your
application. You might need to multiplex thousands of
requests to just a few objects. (TPC/C benchmarks rely on
this.)

Is This Answer Correct ?    3 Yes 3 No

What are object pooling and connection pooling and difference?..

Answer / guest

Connection Pooling:-
-Creation is on the same thread, so if there is nothing in
the pool, a connection is created on your behalf.
-There is nothing like minimum value or maximum value.
Object pooling :-
-The pool might decide to create a new object. However, if
you have already reached your maximum, it instead gives you
the next available object. This is crucial behavior when it
takes a long time to create an object, but you do not use it
for very long.
-We can set minimum and maximum values of object pooling.

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More Dot Net General Interview Questions

When we use windows api in .net is it managed or unmanaged code?

0 Answers  


Explain the procedure to add assemly to gac to make it shared one?

0 Answers  


What is "common language runtime" (clr) in .net?

0 Answers  


What is the microsoft .net?

0 Answers  


What is a garbage collector?

0 Answers  






1 mor thing guyz....can i go for C# directly without C++ /JAVA knowledge for dot net ..???

3 Answers  


Explain boxing and unboxing in .net.

0 Answers  


How viewstate is being formed and how it is stored on client in .net?

0 Answers  


What is Serialiazation?

1 Answers   TCS,


What is the difference between response.redirect & server.transfer?

0 Answers  


What is JIT and how is works?

3 Answers  


How will you register com+ services?

1 Answers  


Categories