Tuesday, August 17, 2021

Oracle -- Database Resident Connection Pooling (DRCP)

 DRCP (11g) is especially designed to help architectures such as PHP with the Apache
server, that can’t take advantage of middle-tier connection pooling because they used
multiprocess single-threaded application servers. DRCP enables applications such as these
to easily scale up to server connections in the tens of thousands.


DRCP is controlled by the following configuration parameters:

INACTIVITY_TIMEOUT maximum idle time for a pooled server before it is terminated.

MAX_LIFETIME_SESSION time to live TTL duration for a pooled session.

MAX_USE_SESSION maximum number of times a connection can be taken and released to the
pool.

MAX_SIZE and MIN_SZIE the maximum and minimum number of pooled servers in the connections
pool.

INCRSIZE pool would increment by this number of pooled server when pooled server
are unavailable at application request time.

MAX_THINK_TIME maximum time of inactivity by the client after getting a server from the
pool. If the client does not issue a database call after grabbing a server
from the pool, the client will be forced to relinquish control of the pooled
server and will get an error. The freed up server may or may not be
returned to the pool.

SESSION_CACHED_CURSORS turn on SESSION_CACHED_CURSORS for all connections in the pool. This is an existing initialization parameter



/* Enabling and Disabling DRCP */

conn sys as sysdba
-- the ramins open after DB restart
exec dbms_connection_pool.start_pool();
select connection_pool, status, maxsize from dba_cpool_info;
exec dbms_connection_pool.stop_pool();

-- specify using DRCP
-- in EZCONNECT method (.Net 11g)
myhost.comany.com:1521/mydb.company.com:POOLED

-- tnsnames
mydb = (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST=myhost.company.com)
(SERVER=POOLED))) 
Page 241 Oracle DBA Code Examples
/* Configuring DRCP */
begin
 DBMS_CONNECTION_POOL.ALTER_PARAM( PARAM_NAME =>'INACTIVITY_TIMEOUT',
PARAM_VALUE=>'3600');
end;
/
-- restore parameter values to their defaults
exec dbms_connection_pool.restore_defaults()
/* Monitor DRCP */
SELECT
STATUS,MINSIZE,MAXSIZE,INCRSIZE,SESSION_CACHED_CURSORS,INACTIVITY_TIMEOUT
FROM DBA_CPOOL_INFO;
SELECT NUM_OPEN_SERVERS, NUM_BUSY_SERVERS, NUM_REQUESTS, NUM_HITS
 NUM_MISSES, NUM_WAITS, NUM_PURGED, HISTORIC_MAX
FROM V$CPOOL_STATS;

-- class-level stats
Select * From V$CPOOL_CC_STATS

No comments:

Post a Comment