Oracle client Dedicated and Shared connection mode

Source: Internet
Author: User
Tags dedicated server

Oracle client Dedicated and Shared connection mode

Dedicated (Dedicated mode)
User processes and server processes are separated.
Each user process has its own server process.
User and server processes can run on different machines to take advantage of distributed processing.
The ratio of user processes to server processes is 1 to 1.
Even if the user process does not send database requests, the dedicated server also exists, but remains idle.
The program interface used here depends on whether the user process and the dedicated server process are on the same machine. If
On the machine, the program interfaces between processes use the Interactive Process Communication (IPC) mechanism of the host operating system.
Displays the connection status of the customer process in the dedicated Oracle service mode:


 
Shared (Shared Mode)
Reduce the number of processes for a routine
Increase the number of users that can be served
Load Balancing
Reduce the number of idle Server Processes
Reduce memory usage and system startup

By default, the connection mode created by the database is exclusive. However, even if the connection mode is changed to shared connection mode, the following conditions must be connected in exclusive mode:
When a job is submitted in batches (for a service process, there is almost no idle time for a job ).

When RMAN is used for backup, recovery or restoration of the database.

 
In addition to Dedicated and Shared, Oracle also provides the Resident Connection Pool Mode (Database Resident Connection Pooling ). This mode is mainly used for web application requests.
A simple example is provided to compare the memory requirements in three connection modes:
Consider that the memory size of each session request of an application is 400 Kb, and each service process needs to use 4 MB of memory. When the pool size is 100 and the maximum number of connections in the sharing mode is 100.
 
In exclusive mode
Memory used = 5000X(400 KB + 4 MB) = 22 GB
In Shared Mode
Memory used = 5000X400 KB + 100X4 MB = 2.5 GB
More than 2.5 GB, 2 GB from SGA
Resident connection pool
Memory used = 100X(400 KB + 4 MB) + (5000 X 35KB) = 615 MB
The memory consumed by each proxy process is close to 35 KB.
 
Configure the Sharing Mode
In shared mode, the following parameters are involved:
SHARED_SERVERS specifies the minimum value when the shared service process starts.
MAX_SHARED_SERVERS specifies the maximum value of a shared service process that can run simultaneously.
SHARED_SERVERS_SESSIONS specifies the total number of user sessions that can be connected to the sharing process at the same time.
DISPATCHERS configures the scheduling process for the Sharing Mode
MAX_DISPATCHERS specifies the maximum number of scheduling processes that can be run simultaneously. This parameter may be ignored now.
CIRCUITS specifies the total number of virtual loops available for inbound and outbound network sessions.
 
To enable the sharing mode, the value of SHARED_SERVERS must be greater than 0. Other related configurations are not required. When the value of SHARED_SERVERS is greater than 0, the scheduling process starts even if the dispatchers parameter is not configured.
 
When DBCA creates a database, Oracle automatically creates a scheduling process for xml db (XDB. This configuration only allows the session to connect to the database in shared mode. To perform some common operations (such as submitting SQL statements), you must configure Additional scheduling or replace the XDB scheduling configuration.
 
Alter system set shared_servers = 5;
 
There is no default value for MAX_SHARED_SERVERS. If this value is null, The PMON process will enable enough shared service processes according to the request. However, it must be subject to the following parameters:
Process restrictions

The minimum value of the idle process slot (at least 1/8 of the total number of process slots, or 2 when the value of the process is less than 24)

System Resources

SHARED_SERVERS_SESSIONS is used to limit the maximum number of user sessions of the concurrent shared service. This parameter is dynamically changed and retains the database Sessions used for exclusive services. This ensures that management tasks such as backup, restoration, and restoration of databases do not occupy shared service sessions.
 
No default value exists for CIRCUITS. This value depends on the value of the scheduling parameter and system resource. Therefore, try to restrict it.
Alter system set circuits = <equal session>;
 
Settings of DISPATCHERS:
Limit the number of address protocols and the minimum number of scheduling processes enabled
Dispatchers = '(address = (pro = tcp) (host = 10. x) (dispatchers = 2 ))'
Dispatchers = '(description = (address = (pro = tcp) (host = 10. x) (dispatchers = 2 )))'
Limit the maximum number of network connections and sessions of dispatchers
Dispatchers = '(pro = tcp) (dispatchers = 2) (conn = 100) (sess = 100 )'
Specify the alias and service name for dispatchers for PMON process registration and scheduling information.
Dispatchers = '(pro = tcp) (dispatchers = 2) (list = orcl) (serv = orcl )'
Allow multiplexing and Connection Pool
Dispatchers = '(pro = tcp) (dispatchers = 2) (multi = on) (poo = on )'
 
Dispatchers can write multiple lines in the configuration file, but must be put together. Or separate them with commas (,) in the same row configuration.
Dispatchers = '(pro = tcp) (dispatchers = 2) (multi = on) (poo = on)', '(pro = tcps) (dispatchers = 2 )'
Or
Dispatchers = '(pro = tcp) (dispatchers = 2) (multi = on) (poo = on )'
Dispatchers = '(pro = tcps) (dispatchers = 2 )'
 
How to determine the number of scheduling processes:
Dispatchers = ceil (max_concurrent_sessions/connections for each dispatcher)
Connections for each dispatcher is determined by the system. the maximum number of connections allowed by a system for a single process is the value of connections for each dispatcher.
 
Configure the TNSNAME. ORA file and change the SERVER mode connected to the client to the SHARED mode.
 
After the preceding parameters are configured, you can connect to the database through sharing. Instance name must be specified during connection
Use the lsnrctl services Command to observe instance Registration Information
Sqlplus user/password @ sid
 
You can use the following views to verify and observe performance:
Select name, paddr, network, status, accept, messages, listener, conf_indx from v $ dispatcher;
Select maximum_connections, maximum_sessions, servers_started from v $ shared_server_monitor;
Select circuit, dispatcher, server, waiter, saddr, status, queue, messsages, bytes from v $ circuit;
V $ dispatcher_config
V $ shared_server
V $ queue
V $ shared_pool_reserved
V $ dispatcher_rate
V $ sga
V $ sgastat
 
You can modify the dispatchers parameter in the following ways:
Alter system set dispatchers = '(index = 0) (pro = tcp) (dispatchers = 2) (multi = on) (poo = on)', '(index = 1) (pro = tcps) (dispatchers = 2 )';
The value after index indicates the sequence of the scheduling process, which can be obtained in v $ dispatcher_config.
 
Disable a specific dispatchers Process
Alter system shutdown immediate 'name of dispatchers'
The name of the dispatchers is from the name field of the v $ dispatcher table.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.