14.2. The DB2 Engine Dispatchable Units
Each circle shown in Figure 14.1 represents a DB2 process. The DB2 engine is where these processes live; hence these processes are called DB2 Engine Dispatchable Units (EDUs). Therefore, a coordinator agent, a page cleaner, and a subagent are all EDUs.The EDUs are implemented as processes on Linux/UNIX platforms and as threads on Windows platforms. Unless explicitly indicated, we use the term process in this chapter to refer to both processes on Linux/UNIX and threads on Windows.Figure 14.2 shows the hierarchy for some main DB2 EDUs.
Figure 14.2. The main DB2 EDUs
[View full size image]

14.2.1. The DB2 Instance-Level EDUs
The core engine process is the DB2 system controller process, db2sysc . This is the first process created when the instance starts. The db2sysc process then spawns other processes to perform various tasks, such as the listeners, which listen for client connections.Table 14.1 lists and describes the DB2 instance-level EDUs.
Figure 14.3. DB2 EDUs after an instance is started
Figure 14.3 shows that each partition has the same set of DB2 EDUs. The last column indicates the partition with which the EDU is associated. Note the db2wdog processes are owned by root, not the instance.On AIX, Linux, and HP-UX, use the ps ef | grep instancename command to display the DB2 processes owned by the instance. Alternatively, you can use the db2_ps command, which displays the DB2 processes under each database partition.On Solaris, the ps ef command only shows db2sysc for all processes (e.g., listeners, loggers, page cleaners, and prefetchers). To display the DB2 processes with their actual names, use the db2ptree command.
root 29464 1 0 19:49:37 - 0:01 db2wdog 0
root 418132 1 0 19:49:38 - 0:01 db2wdog 1
db2inst1 121078 263592 0 19:49:46 - 0:00 db2pdbc 0
db2inst1 135778 263592 0 19:49:46 - 0:00 db2ipccm 0
db2inst1 263592 29464 0 19:49:39 - 0:00 db2sysc 0
db2inst1 269678 394674 0 19:49:45 - 0:00 db2pdbc 1
db2inst1 297878 263592 0 19:49:45 - 0:00 db2fcmdm 0
db2inst1 308610 394674 0 19:49:45 - 0:00 db2resync 1
db2inst1 315772 541832 0 19:49:47 - 0:00 db2srvlst 0
db2inst1 321520 394674 0 19:49:45 - 0:00 db2ipccm 1
db2inst1 324388 394674 0 19:49:44 - 0:00 db2gds 1
db2inst1 341672 394674 0 19:49:44 - 0:00 db2fcmdm 1
db2inst1 369054 394674 0 19:49:45 - 0:01 db2hmon 1
db2inst1 394674 418132 0 19:49:40 - 0:00 db2sysc 1
db2inst1 396446 394674 0 19:49:45 - 0:00 db2panic (idle) 1
db2inst1 405400 263592 0 19:49:47 - 0:00 db2panic (idle) 0
db2inst1 456718 263592 0 19:49:47 - 0:01 db2hmon 0
db2inst1 519040 263592 0 19:49:47 - 0:00 db2resync 0
db2inst1 541832 263592 0 19:49:41 - 0:00 db2gds 0
db2inst1 573828 324388 0 19:49:45 - 0:00 db2srvlst 1
14.2.2. The DB2 Database-Level EDUs
When a database starts, it starts several processes to handle database-level tasks such as prefetching, logging, and page cleaning. These processes are spawned by the db2gds process on Linux/UNIX platforms and by db2sysc on Windows platforms.Table 14.2 shows the DB2 EDUs at the database level.
Process Name | Description | Applicability |
---|---|---|
db2dlock | Local deadlock detector. One per database partition. Scans the lock list and looks for deadlock conditions. When a deadlock condition is encountered, one of the applications/transactions involved is chosen as the victim and rolled back. | All |
db2estor | Copies pages between the database buffer pool(s) and extended storage. These processes appear only when extended storage is enabled for a database. | All |
db2event | The event monitoring process. There is one db2event process per active event monitor, per active database. These processes capture the defined "events" and write to the output file specified for the Event Monitor. | |
db2loggr | The database log reader. Reads the database log files during transaction processing (i.e., roll back and roll forward operations) and restart recovery. | All |
db2loggw | The database log writer. Flushes log records from the log buffer to the log files on disk. | All |
db2logts | Collects historical information about which logs are active when a table space is modified. This information is recorded in the DB2TSCHG.HIS file in the database directory. It speeds up table space roll forward recovery by enabling the skipping of log files that are not needed for the roll forward operation. | All |
db2pclnr | The buffer pool page cleaners. Asynchronously writes dirty pages from the buffer pool(s) back to disk. (A dirty page is one that was changed after it was read into the buffer pool, and the image on disk is no longer the same as the image in the buffer pool.) Works to ensure that there is room in the buffer pools for new pages being retrieved for applications.When the page cleaners are "triggered," they all run at the same time. Once they complete their assigned work they sleep until triggered again. The number of page cleaners per database is configured by the NUM_IOCLEANERS database configuration parameter. | All |
db2pfchr | The buffer pool prefetchers. Reads data and index information from disk and into the database buffer pool(s) before it is read on behalf of applications. Prefetchers perform this "read-ahead" asynchronously.The DB2 agents, acting on behalf of the applications, send prefetch requests which are serviced by the prefetchers. The prefetchers perform big-block I/O to read the data more efficiently.The number of prefetchers per database is configured by the NUM_IOSERVERS database configuration parameter. | All |
Figure 14.4. The database-level DB2 EDUs after the SAMPLE database is started
db2inst1 57846 324388 0 19:53:42 - 0:00 db2loggr (SAMPLE) 1
db2inst1 71504 541832 0 19:53:43 - 0:00 db2agent (idle) 0
db2inst1 128880 324388 0 19:53:43 - 0:00 db2event (DB2DETAILDEADLOCK) 1
db2inst1 132764 541832 0 19:53:43 - 0:00 db2pfchr 0
db2inst1 135778 263592 0 19:49:46 - 0:00 db2ipccm 0
db2inst1 169298 541832 0 19:53:43 - 0:00 db2pfchr 0
db2inst1 183970 541832 0 19:53:42 - 0:00 db2lfr (SAMPLE) 0
db2inst1 205302 324388 0 19:53:42 - 0:00 db2lfr (SAMPLE) 1
db2inst1 213500 324388 0 19:53:42 - 0:00 db2pfchr 1
db2inst1 218468 541832 0 19:53:43 - 0:00 db2pclnr 0
db2inst1 246144 541832 0 19:53:43 - 0:00 db2dlock (SAMPLE) 0
db2inst1 275236 324388 0 19:53:42 - 0:00 db2dlock (SAMPLE) 1
db2inst1 355768 324388 0 19:53:42 - 0:00 db2loggw (SAMPLE) 1
db2inst1 381136 541832 0 19:53:42 - 0:00 db2loggw (SAMPLE) 0
db2inst1 419484 541832 0 19:53:43 - 0:00 db2pfchr 0
db2inst1 439484 324388 0 19:53:42 - 0:00 db2glock (SAMPLE) 1
db2inst1 458448 324388 0 19:53:42 - 0:00 db2agntp (SAMPLE) 1
db2inst1 468242 324388 0 19:53:42 - 0:00 db2pclnr 1
db2inst1 483634 541832 0 19:53:42 - 0:00 db2loggr (SAMPLE) 0
db2inst1 492846 324388 0 19:53:42 - 0:00 db2pfchr 1
db2inst1 532004 324388 0 19:53:42 - 0:00 db2pfchr 1
db2inst1 546646 135778 0 19:53:42 - 0:00 db2agent (SAMPLE) 0
14.2.3. The Application-Level EDUs
Application-level EDUs are agents. After the listener process accepts a client connection, it takes a free agent, db2agent , from the idle agent pool. If no free agent is available, a new db2agent will be created. The db2agent becomes the coordinator agent for the application, and it will perform all database operations on behalf of the application. There are four types of DB2 agents.
- Coordinator agents
- Active subagents
- Associated subagents
- Unassociated agents
A coordinator agent (db2agent) coordinates the work on behalf of an application and communicates to other agents using the inter-process communication (IPC) protocol (for local connections) or remote communication protocol (for remote connections). Each connection request from client applications is allocated a coordinator agent.Figure 14.4 shows that the db2agent process
is assigned to a connection to the SAMPLE database. The SAMPLE in parenthesis indicates the database name that the db2agent is associated with. Note that this db2agent process is created by the db2ipccm process. (Its parent PID 135778 matches the db2ipccm process in section 14.5, The Connection Concentrator.) In a partitioned database environment, the coordinator agent exists on the partition that the application is connected to. In this example, it exists on partition 0 (this is indicated by the 0 beside SAMPLE ), because this is the partition from where the connection request was issued.In a DPF environment, or when the INTRA_PARALLEL Database Manager Configuration parameter is enabled, the coordinator agent distributes the database requests to an active subagent , db2agntp . These subagents perform the work and return the result set to the coordinator agent to return to the application.In Figure 14.4, one subagent, db2agntp , is shown:
db2inst1 546646 135778 0 19:53:42 - 0:00 db2agent (SAMPLE) 0
This is because db2inst1 is a multi-partition instance with two database partitions. This subagent works for the coordinator agent 546646 on database partition 1.When a subagent completes its work it becomes an associated (idle) subagent. It changes its name from db2agntp to db2agnta , and it is returned to the application's agent pool. However, it is still associated with the application. When needed, it is called by the coordinator agent or the active subagents to service the same application again. Or it can be stolen by another application, if that application cannot find an idle agent or no more agents can be created (MAXAGENTS is reached). This improves performance by minimizing the creation and destruction of EDUs.The idle db2agnta agents remain associated with the application as long as the total number of idle agents in the instance does not exceed the value of the NUM_POOLAGENTS Database Manager Configuration parameter. If the number of NUM_POOLAGENTS has already been reached, then the db2agnta process disassociates itself from the application and terminates. If subagents must be constantly created and reassociated to applications, performance suffers. (See Chapter 16, Database Performance Considerations, for a discussion on tuning of the NUM_POOLAGENTS parameter.)Unassociated agents are idle agents (db2agent) not associated with any existing applications. They are ready for use by any incoming client connections, and can be called by any coordinator agents or active subagents to perform work.Figure 14.4 shows an idle db2agent:
db2inst1 458448 324388 0 19:53:42 - 0:00 db2agntp (SAMPLE) 1
Again, the number of idle agents is determined by the NUM_POOLAGENTS Database Manager Configuration parameter. The DB2 agent pool is shared by all databases in an instance, not just one database.Table 14.3 lists the DB2 EDUs at the application level.
db2inst1 71504 541832 0 19:53:43 - 0:00 db2agent (idle) 0
Process Name | Description | Applicability |
---|---|---|
db2agent | DB2 coordinator/coordinating agent that performs all database requests on behalf of an application. There is one db2agent process per connected application, unless the connection concentrator is enabled.If intra-partition parallelism is enabled, the db2agent process calls the DB2 subagents to perform the work, and they return the result set to the coordinator agent to return to the application.In a partitioned database, the coordinator agent exists on the partition which the application connected to. | All |
db2agentg | The gateway agent for DRDA application requesters. | All |
db2agnsc | The parallel recovery agent. During roll forward and restart recovery, performs the actions from the logs in parallel. This can improve recovery time in comparison to a serial recovery.Note : This process enables parallelism within logged transactions as well as between parallel transactions. | All |
db2agnta | An idle subagent used in the past by a coordinating agent and still associated to that coordinating agent process. Appears when the INTRA_PARALLEL dbm cfg parameter is set to YES or in a partitioned database environment. | All |
db2agntp | A subagent that is currently performing work on behalf of the coordinating agent it is associated with. These processes provide intra-partition parallelism, that is, the ability to execute a query in parallel within a database instance/partition. Appears when the INTRA_PARALLEL dbm cfg parameter is set to YES or in a partitioned database environment. | All |
14.2.4. Per-Request EDUs
Table 14.4 lists the per-request DB2 EDUs.
Figure 14.5. The DB2 EDUs responsible for backing up a database
db2inst1 71504 541832 0 19:53:43 - 0:00 db2bm.546646.0 0
db2inst1 328336 541832 0 19:59:37 - 0:00 db2med.546646.0 0
db2inst1 541832 263592 0 19:49:41 - 0:00 db2gds 0