Specify listen and poll threads for the client/server connection

When you start the database server, the oninit process starts an internal thread, called a listen thread, for each dbservername that you specify with the DBSERVERNAME and DBSERVERALIASES parameters in the onconfig file.

To specify a listen port for each of these dbservername entries, assign it a unique combination of hostname and service name entries in sqlhosts. For example, the sqlhosts file or registry entry shown in the following table causes the database server soc_ol1 to start a listen thread for port1 on the host, or network address, myhost.
Table 1. A listen thread for each listen port
dbservername nettype hostname service name
soc_ol1 onsoctcp myhost port1

The listen thread opens the port and requests one of the poll threads for the specified interface/protocol combination to monitor the port for client requests. The poll thread runs either in the CPU virtual processor or in the network virtual processor for the connection that is being used. For information about the number of poll threads, see Specify the number of networking virtual processors.

For information about how to specify whether the poll threads for an interface/protocol combination run in CPU or network virtual processors, see Run poll threads on CPU or network virtual processors and to the NETTYPE configuration parameter in the HCL OneDB™ Administrator's Reference.

When a poll thread receives a connection request from a client, it passes the request to the listen thread for the port. The listen thread authenticates the user, establishes the connection to the database server, and starts an sqlexec thread, the session thread that performs the primary processing for the client. The following figure illustrates the roles of the listen and poll threads in establishing a connection with a client application.
Figure 1: The roles of the poll and the listen threads in connecting to a client

The paragraphs that precede this figure describe the content of the figure.

A poll thread waits for requests from the client and places them in shared memory to be processed by the sqlexec thread. For network connections, the poll thread places the message in a queue in the shared-memory global pool. The poll thread then wakes up the sqlexec thread of the client to process the request. Whenever possible, the sqlexec thread writes directly back to the client without the help of the poll thread. In general, the poll thread reads data from the client, and the sqlexec thread sends data to the client.

UNIX only: For a shared-memory connection, the poll thread places the message in the communications portion of shared memory.
The following figure illustrates the basic tasks that the poll thread and the sqlexec thread perform in communicating with a client application.
Figure 2: The roles of the poll and sqlexec threads in communicating with the client application

The paragraphs that precede this figure describe the content of the figure.