dedicated server & shared server - - get a free blog
TRANSCRIPT
DEDICATED SERVER
& SHARED SERVER
Prepared By: L. Huyam Al-Amro
LECTURE 4
SERVER PROCESS
Server process: Gets requests from the user process
and interacts with the oracle instance to carry out
the requests:
Parsing and executing SQL statement via the
application or tool.
Reading the data files and bringing data blocks
into the buffer cache.
Returning the results to the user process in such a
way that it can understand the data.
Prepared By: L. Huyam Al-Amro
USER PROCESS
User process:
It is started when the user run the application tool
(application program or oracle tool).
It may be on the same machine where the
instance/database resides, or it may be initiated
from a client machine in a client/server
architecture.
Prepared By: L. Huyam Al-Amro
DEDICATED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
DEDICATED SERVER CONFIGURATION
One server process is created for each connectionrequest.
1. The client application or tool initiates the userprocess to connect to the instance.
2. The client machine communicates the request to theserver machine by using Oracle Net Drivers. TheOracle Net Listener on the server detects therequest and starts (create) a dedicated serverprocess after verifying the user name andpassword.
Prepared By: L. Huyam Al-Amro
DEDICATED SERVER CONFIGURATION
3. The user issues a SQL command.
4. The dedicated server process determines whether
a similar SQL is in the shared SQL area. If not, it
allocates a new shared SQL area for the
command and stores the parse tree.
5. During parsing, the server process checks for
syntactic correctness of the statement, checks
whether the object names are valid, and
privileges.
Prepared By: L. Huyam Al-Amro
DEDICATED SERVER CONFIGURATION
The required information is obtained from the data
dictionary cache. A PGA is created to store the
private information of the process.
6. The server process looks for data blocks that need
to be changed or accessed in the buffer cache. If
they are not there, it reads the data files and
brings the necessary blocks to the SGA.
7. The server process executes the SQL statement.
Prepared By: L. Huyam Al-Amro
DEDICATED SERVER CONFIGURATION
8. If data blocks need to be changed, they are
changed in the buffer cache (the DBWn process
updates the data file). The change is logged in the
redo log buffer.
9. The result is returned to the User process.
Prepared By: L. Huyam Al-Amro
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
One server process manage multiple user processes.
1. When the instance is started, one or more shared
server processes and dispatcher processes are
started. The OracleNet Listener is running on the
server. The request and response queues are
created in the SGA.
2. The client application or tool initiates the user
process to connect to the instance.
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
3. The client machine communicates the request to the
server machine by using OracleNet drivers. The
OracleNet Listener on the server detects the
request and identifies the protocol that the user
process is running. It connects the user process to
one of the dispatchers for this protocol (if no
dispatcher is avaliable for the requested protocol,
a dedicated server process is started by the
listener).
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
4. The user issues a SQL command.
5. The dispatcher decodes the request and puts it
into the request queue (at the tail) along with the
dispatcher ID.
6. The request moves up the queue as the server
processes serve the previous requests. The next
available shared server process picks up the
request.
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
7. The shared server process determines whether a
similar SQL statement is in the shared SQL area. If
not, it allocates a new shared SQL area for the
command and stores the parse tree.
8. After SQL execution, the shared server process
places the result in the response queue along with
the dispatcher ID.
SHARED SERVER CONFIGURATION
Prepared By: L. Huyam Al-Amro
9. The result is returned to the User process by the
dispatcher process.
DIFFERENCE BETWEEN DEDICATED
SERVER & SHARED SERVER
Prepared By: L. Huyam Al-Amro
EXAMPLE OF MEMORY USAGE FOR
DEDICATED SERVER & SHARED SERVER
Prepared By: L. Huyam Al-Amro
Consider an application in which the memory required
for each session is 400 KB and the memory required for
each server process is 4 MB. The pool size is 100 and
the number of shared servers used is 100.
If there are 5000 client connections, the memory used
by each configuration is as follows:
EXAMPLE OF MEMORY USAGE FOR
DEDICATED SERVER & SHARED SERVER
Prepared By: L. Huyam Al-Amro
Dedicated Server
Memory used = 5000 X (400 KB + 4 MB) = 22 GB
Shared Server
Memory used = 5000 X 400 KB + 100 X 4 MB = 2.5
GB
CONFIGURING ORACLE DATABASE FOR
SHARED SERVER
Prepared By: L. Huyam Al-Amro
Initialization Parameters for Shared Server:
The following initialization parameters control shared server operation:
■ SHARED_SERVERS: Specifies the initial number of shared servers to start and the minimum number of shared servers to keep. This is the only required parameter for using shared servers.
■ MAX_SHARED_SERVERS: Specifies the maximum number of shared servers that can run simultaneously.
CONFIGURING ORACLE DATABASE FOR
SHARED SERVER
Prepared By: L. Huyam Al-Amro
■ SHARED_SERVER_SESSIONS: Specifies the total
number of shared server user sessions that can run
simultaneously. Setting this parameter enables you
to reserve user sessions for dedicated servers.
■ DISPATCHERS: Configures dispatcher processes in
the shared server architecture.
■ MAX_DISPATCHERS: Specifies the maximum
number of dispatcher processes that can run
simultaneously.
ENABLING SHARED SERVER
Prepared By: L. Huyam Al-Amro
Shared server is enabled by setting the
SHARED_SERVERS initialization parameter to a
value greater than 0.
If SHARED_SERVERS is not included in the
initialization parameter file at database startup,
but DISPATCHERS is included and it specifies at
least one dispatcher, shared server is enabled. In
this case, the default for SHARED_SERVERS is 1.
ENABLING SHARED SERVER
Prepared By: L. Huyam Al-Amro
Shared server can be started dynamically by
setting the SHARED_SERVERS parameter to a
nonzero value with the ALTER SYSTEM statement.
Example: ALTER SYSTEM SET SHARED_SERVERS = 5;
If SHARED_SERVERS is not included in the
initialization parameter file, or is included but is set
to 0, then shared server is not enabled at database
startup.