Within the database server, CPU cycles are assigned to the run queue according to
dispatching priority.
Those tasks with a high dispatching priority move to the top of the CPU run queue while use tasks with a lower dispatching priority wait in a
first-in, first-out (FIFO) queue where the earliest in line is the first served.
There is a direct relationship between CPU cycles and dispatching priorities in Oracle 23c, particularly when using the Oracle Database Resource Manager (DBRM). Hereβs how it works:
π§ 1. Oracle 23c CPU Resource Management Overview
Oracle 23c uses the Database Resource Manager to control how CPU cycles are allocated to sessions and consumer groups, which in turn impacts dispatching priority.
- High priority sessions (based on user-defined resource plans) are given more access to CPU resources.
- Low priority sessions may be queued or receive a smaller share of CPU cycles, depending on CPU availability.
π¦ 2. Dispatching Priority and the CPU Run Queue
Oracle internally maintains a CPU run queue, much like an OS does. Here's the tie-in:
Concept |
Description |
Dispatching Priority |
A relative measure (assigned by DBRM or internal scheduler) of which session should be scheduled to run on the CPU. |
CPU Cycles |
The actual time slices granted by the Oracle process scheduler to run instructions. |
Run Queue |
Sessions waiting for CPU; high-priority sessions jump ahead in this queue. |
So, dispatching priority determines the order in the run queue, and thus influences who gets CPU cycles first.
π§ 3. How Oracle 23c Implements This
Oracle uses:
- CPU methods like Emulated Fair Queuing (EFQ) or Proportional Share Scheduling.
- Resource plans, which allocate percentages of CPU resources to consumer groups.
- Automatic queuing: If a session exceeds its CPU allocation, it is delayed or queued, preserving overall fairness and system responsiveness.
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN(
simple_plan => 'cpu_plan',
consumer_group1 => 'OLTP_USERS',
group1_percent => 80,
consumer_group2 => 'BATCH_USERS',
group2_percent => 20
);
END;
In this example:
- OLTP_USERS will get 80% of CPU cycles β higher dispatch priority.
- BATCH_USERS will only get 20% β lower dispatch priority.
- Tasks from OLTP_USERS will jump ahead in the CPU run queue.
π Summary
In Oracle 23c:
- Dispatching priorities directly control the allocation of CPU cycles.
- Oracle's Database Resource Manager ensures that sessions with higher priority get scheduled sooner and more frequently.
- This mechanism ensures predictable performance and workload isolation, especially in multitenant and cloud environments.
Sometimes, you may want to lower the default dispatching priority. For example, a long-running batch task can be given a lower priority so that
online transactions will get faster service. The next lesson shows how to do this with the nice command.
This is a key use case for dispatching priority control in Oracle 23c using the
Database Resource Manager (DBRM).
β
Why Lower Dispatching Priority?
In mixed workloads (OLTP + batch), long-running or background jobs can:
- Consume CPU cycles disproportionately.
- Delay response times for high-priority OLTP users.
π Solution: Lower the Dispatching Priority for Batch Jobs
You can assign batch processing sessions to a consumer group with a lower CPU percentage, effectively reducing their dispatching priority.
π οΈ Example Using DBRM in Oracle 23c
BEGIN
DBMS_RESOURCE_MANAGER.CREATE_SIMPLE_PLAN(
simple_plan => 'mixed_workload_plan',
consumer_group1 => 'OLTP_USERS',
group1_percent => 90,
consumer_group2 => 'BATCH_JOBS',
group2_percent => 10
);
END;
This configuration ensures:
- OLTP_USERS get 90% of CPU resources β higher dispatching priority.
- BATCH_JOBS get 10% β lower dispatching priority, which queues them longer.
π― Benefit
This prioritization:
- Keeps user-facing transactions responsive.
- Prevents background jobs from starving the system, while still allowing them to proceed at a reduced pace.