Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain the basic principle of Oracle 11g DRCP connection in detail.

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Learning Oracle is a complex and tedious process. In front of the vast number of Oracle official materials, new features, MOS materials and all kinds of Internal knowledge, we always feel powerless and at a loss. However, this is often the pleasure that we continue to adhere to, accumulate and pursue.

In Oracle 11g, the third connection mode, Database Resident Connection Pooling (DRCP), is proposed to break through the traditional private / shared connection. In this article, we will discuss this technology together.

1. From Dedicated Server to Shared Server

Traditionally, there are two ways for Client Process to connect to Server Process: Dedicated Server and Shared Server. When Client is connected to Oracle Server, the default is to locate the Oracle instance service through the listener. Only the child process sent out by the listener fork requests a Server Process to communicate with Client Process remotely from Instance. Different connection methods are reflected in how the database instance provides the Server Process process after receiving the Server Process request, and how the process is managed.

Dedicated Server mode is also known as private connection mode, where Oracle Instance creates a new Server Process to communicate remotely with Client Process. Throughout the Client Process request, Server Process serves only that Client. UGA information is also stored in the PGA space of Server Process. When the session ends and the Client connection is interrupted, the Server Process loses its "existential meaning" and is erased and allocated memory is reclaimed. Dedicated is the most commonly used database connection method. In the case of long sessions or front-end applications using connection pooling components, the advantages of the Dedicated approach are obvious.

Corresponding to the Dedicated Server mode is Shared Server. In this mode, the Oracle instance maintains two types of Server Process: the distribution process (Dispatcher DXXX) and the shared process (SXXX).

SQL > select addr, pid, spid, username, program from v$process where program like'0% SYSTEM ORACLE.EXE; ADDR PID SPID USERNAME PROGRAM--6D24BA1C 13 648 SYSTEM ORACLE.EXE (D000) 6D24C00C 14 1736 SYSTEM ORACLE.EXE (S000)

When the listener makes a Server Process allocation request to the database instance, in Shared Server mode, the listener allocates Server Process to the distribution process DXXX request. DXXX allocates a Server Process for use based on the current free Server situation. When the use of Client is over, Server Process (SXXX) is not released, but is returned to D000 control. The system will also maintain a stable number of SXXX according to the parameter settings.

SQL > show parameter shared_serversNAME TYPE VALUE-- max_shared_servers integer shared_servers integer 1

The emergence of Shared Server connection mode is related to the development of Internet applications with short sessions and high concurrency. The cost of creating and recycling Server Process each time is high. If the application does not have a middle-tier connection pool, but creates Server Process with high concurrency and reclaims it quickly, it is very stressful for the database.

From the perspective of current application design and development, connection pool management has penetrated into the mainstream application framework, and shared server is not widely used in practice.

2. Database Resident Connection Pooling (DRCP)

If we look at it from a software schema point of view, Shared Server essentially wants to implement a connection pool at the database level. This is achieved on Oracle 11g, where Oracle resident connection pooling (DRCP) is a new feature that allows connections to be shared between multiple processes (Multi-Process) and multiple threads (Multi-Threads).

Shared server alleviates the problem of Server process IDEL and frequent creation and destruction of Server process to some extent. However, Shared Server does not solve the problem of Session data sharing. This model works when there is a client that requires holding the session for a long time and other client does not have a large number of session requirements. However, when each request session is short (short session) and database activity requires multiple session interactions, DRCP is a better connection pooling model.

The new feature of DRCP is mainly aimed at the problem of high number of concurrent connections when applications access the database. DRCP connection pooling caches Server and Session information to provide connection sharing for multiple accessed applications.

Like Shared Server, there is an agent (Connection Broker) at the DRCP front end that is responsible for the sharing requirements of application middleware connections and for managing connection pooling connections on the database instance. When the application middleware asks Broker for a connection, Broker will find the free connection from the connection pool. When the interaction is over, the Server Process is released back to the connection pool for reuse.

What's different from shared server is that. When the connection pool is allocated in the shared pool, it is equivalent to the dedicated server mode.

3. Memory usage of the three connection modes

Under the three connection methods, Oracle instances, Server Process and memory are used in different ways.

Dedicated Server mode

When Client Server requests a connection, new Server Process and session information is created. When the connection is broken, Server Process and Session are all released. Memory allocation is a connection to allocate space for Server Process and Session. UGA information is stored in PGA.

Shared Server mode

When a request from Client Server is received, Dispatcher places the request in an common queue. The available Server Process gets the request information from the queue. When the session is terminated, the corresponding session information is released. The Session information is allocated from the SGA.

DRCP mode

After the Client Server request, Connection Broker looks for a free Pooled Server from the connection pool to provide to Client Server. If there is no free one, Connection Broker creates a new connection. If the current connection pool has reached the maximum limit, the request is placed in a waiting queue for free Server.

When you release Pooled Server and return to Connection Pool, the corresponding database resources are released. The memory requirements for DRCP are related to the storage pool size and session. Each Pooled Server has one Session information, which is stored in the PGA.

The following allocation example illustrates the situation:

Scenario: an application that requires 400k of space per session. Each Server process corresponds to 4m space. The connection pool size is 100, and the amount of shared shared Server size data is also 100. If there are 5000 connections.

In Dedicated Server mode:

Memory Usage=5000* (0.4M+4M) = 22GB

In Shared Server mode:

Memory Usage=5000 × 0.4M+4M × 100x 2.5GB; note that 2G of the Session information is allocated from the SGA.

In DRCP mode:

Memory Usage=100 × (4M+0.4M) + 5000 × 35K=615MB. Note: 35K is the amount of memory used to maintain session information.

4. Conclusion

DRCP mode provides a more mature data connection pool solution for front-end applications on the basis of traditional shared server. From the current data, DRCP provides support for OCI, PHP and other drivers. Note: support for JDBC Thin and JDBC OCI does not exist yet.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report