2.4 Understanding Service Handlers

Service handlers act as connection points to an Oracle database. A service handler can be a dispatcher or a dedicated server process, or pooled.

2.4.1 About Dispatchers

The shared server architecture uses a dispatcher process to direct client connections to a common request queue. An idle shared server process from a shared pool of server processes picks up a request from the common queue. This approach enables a small pool of server processes to serve a large number of clients. A significant advantage of the shared server model over the dedicated server model is reduced system resources, enabling support of an increased number of users.

The listener uses the dispatcher as a type of service handler to which it can direct client requests. When a client request arrives, the listener performs one of the following actions:

  • Hands the connection request directly to a dispatcher.

  • Issues a redirect message to the client, containing the protocol address of a dispatcher. The client then terminates the network session to the listener and establishes a network session to the dispatcher, using the network address provided in the redirect message.

The listener uses direct hand off whenever possible. Redirect messages are used, for example, when dispatchers are remote to the listener.

The following figure shows the listener handing a connection request directly to a dispatcher.

  1. The listener receives a client connection request.

  2. The listener hands the connect request directly to the dispatcher.

  3. The client is now connected to the dispatcher.

Figure 2-5 Direct Hand Off to a Dispatcher

Description of Figure 2-5 follows
Description of "Figure 2-5 Direct Hand Off to a Dispatcher"

The following figure shows the role of a dispatcher in a redirected connection.

  1. The listener receives a client connection request.

  2. The listener provides the location of the dispatcher to the client in a redirect message.

  3. The client connects directly to the dispatcher.

Figure 2-6 Redirected Connection to a Dispatcher

Description of Figure 2-6 follows
Description of "Figure 2-6 Redirected Connection to a Dispatcher"

2.4.2 About Dedicated Server Processes

In a dedicated server configuration, the listener starts a separate dedicated server process for each incoming client connection request dedicated to servicing the client. After the session is complete, the dedicated server process terminates. Because a dedicated server process has to be started for each connection, this configuration may require more system resources than shared server configurations.

A dedicated server process is a type of service handler that the listener starts when it receives a client request. To complete a client/server connection, one of the following actions occurs:

  • The dedicated server inherits the connection request from the listener.

  • The dedicated server informs the listener of its listening protocol address. The listener passes the protocol address to the client in a redirect message and terminates the connection. The client connects to the dedicated server directly using the protocol address.

One of the preceding actions is selected based on the operating system and the transport protocol.

If the client and database exist on the same computer, then a client connection can be passed directly to a dedicated server process without going through the listener. This is known as a bequeath protocol. The application initiating the session spawns a dedicated server process for the connection request. This happens automatically if the application used to start the database is on the same computer as the database.

Note:

In order for remote clients to connect to dedicated servers, the listener and the database instance must be running on the same computer.

Figure 2-7 shows the listener passing a client connection request to a dedicated server process.

  1. The listener receives a client connection request.

  2. The listener starts a dedicated server process, and the dedicated server inherits the connection request from the listener.

  3. The client is now connected directly to the dedicated server.

Figure 2-7 Connection to a Dedicated Server Process

Description of Figure 2-7 follows
Description of "Figure 2-7 Connection to a Dedicated Server Process"

Figure 2-8 shows the role of a dedicated server in a redirected connection.

  1. The listener receives a client connection request.

  2. The listener starts a dedicated server process.

  3. The listener provides the location of the dedicated server process to the client in a redirect message.

  4. The client connects directly to the dedicated server.

Figure 2-8 Redirected Connection to a Dedicated Server Process

Description of Figure 2-8 follows
Description of "Figure 2-8 Redirected Connection to a Dedicated Server Process"

2.4.3 About Database Resident Connection Pooling

Database resident connection pooling provides a connection pool in the database server for typical web application usage scenarios in which an application acquires a database connection, works on it for a relatively short duration, and then releases it. Database resident connection pooling pools "dedicated" servers. A pooled server is the equivalent of a server foreground process and a database session combined. Database resident connection pooling uses dynamic registration between the server and the listener. It cannot use static registration.

Database resident connection pooling complements middle-tier connection pools that share connections between threads in a middle-tier process. In addition, it enables sharing of database connections across middle-tier processes on the same middle-tier host and even across middle-tier hosts. This results in significant reduction in key database resources needed to support a large number of client connections, thereby reducing the database tier memory footprint and boosting the scalability of both middle-tier and database tiers. Having a pool of readily available servers has the additional benefit of reducing the cost of creating and closing client connections.

Database resident connection pooling provides pooling for dedicated connections across client applications and processes. This feature is useful for applications that must maintain persistent connections to the database and optimize server resources, such as memory.

Clients obtaining connections out of the database resident connection pool are persistently connected to a background process, the connection broker, instead of the dedicated servers. The connection broker implements the pool functionality and performs the multiplexing of inbound connections from the clients to a pool of dedicated servers with sessions.

When a client must perform database work, the connection broker picks up a dedicated server from the pool and assigns it to the client. Subsequently, the client is directly connected to the dedicated server until the request is served. After the server finishes processing the client request, the server goes back into the pool and the connection from the client is restored to the connection broker.

The following figure shows the process.

Figure 2-9 Dedicated Server Processes Handling Connections Through the Connection Broker Process

Description of Figure 2-9 follows
Description of "Figure 2-9 Dedicated Server Processes Handling Connections Through the Connection Broker Process"