Skip to Main Content
  • Questions
  • Session Pool vs. Connection Pool vs DRCP

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Andrey.

Asked: March 22, 2022 - 9:46 am UTC

Last updated: March 28, 2022 - 2:40 am UTC

Version: 19c

Viewed 10K+ times! This question is

You Asked

Hello,

please, can someone clarify, how all these Pools work together? If understand it correctly, Session Pool and Connection Pool are on Client side, DRCP is on the Server side. If I choose Session Pool, then OCI maintains sessions and connections for my application. If I choose Connection Pool, then I should worry about allocating sessions and OCI takes care about connections.

DRCP is completely independent from things on Client side. It performs pooling of server resources independent from presence of absence of pools on the client side.

Is the above picture correct? Or is it completely wrong?

How comes OCI_ATTR_CONNECTION_CLASS into the above picture? Is it used by DRCP on Server side, or by Connection Pool on Client side? Is it relevant for Session Pools?

Thank you

and Connor said...

Your "picture" is pretty much correct. I generally don't use the term "on client side" or "on server side", but more about "knowledge", ie, with a conventional connection pool, the client *knows* about the pool because it initiated it. The connections are still on the server not the client, but the client side has code that explicitly knows that its using a pool (OCISessionPoolCreate, OCISessionGet, OCISessionRelease, OCISessionPoolDestroy etc etc).

DRCP was invented because some application stacks don't have the concept of connection management really at all. They were designed in a day where every database interaction was:

a- establish a brand new connection
b- do some work
c- drop the connection

and (a) and (c) in oracle are expensive operations. So DRCP provides a "facade". The app *thinks* it is creating and destroying new connections, but we're "secretly" mapping that into standard connection pool management.

So if you code stack supports connection pooling (Java/JDBC, C#/Dot.net etc etc), then you'd typically manage it yourself. An exception sometimes to that rule is when the number of apps grow over time. You might start with 5 apps each and you're doing the right thing by keeping the connection pool size small for each with (say) a pool size of 10, totalling 50 connections. But in 5 years time, you've now got 200 apps...Now you have 2000 server connections. In that case, you might choose to change to DRCP to allow a pool that is shared across multiple apps to keep the connection count efficient.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

OCI_ATTR_CONNECTION_CLASS

Andrey Voropaev, March 25, 2022 - 3:06 pm UTC

Thank you, I believe I understand the answer:)

You didn't say anything about OCI_ATTR_CONNECTION_CLASS? It is kind of necessary for Connection Pool. Do I also have to use it with Session Pool?
Connor McDonald
March 28, 2022 - 2:40 am UTC

I don't know much about it besides what is in the docs:

Connection Class

Connection class defines a logical name for the type of connection required by the application. Sessions from the OCI session pool cannot be shared by different users (A session first created for user HR is only given out to subsequent requests by user HR.) The connection class setting allows for further separation between the sessions of a given user. The connection class setting lets different applications (connecting as the same database user) identify their sessions using a logical name that corresponds to the application. OCI then ensures that such sessions belonging to a particular connection class are not shared outside of the connection class.


https://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci09adv.htm#LNOCI16634

but my reading of that is you'd only need it if you are carving up session *within* a schema

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database