In job scheduling, you can use two strategies to implement application-level throttling: enable throttling and set an appropriate queue size, or configure a preemptive priority queue. These strategies help ensure the stability of your scheduling system and the timely execution of critical jobs. This topic explains how to effectively manage application-level resources and schedule jobs based on priority.
Use cases
Job scheduling systems can face immense pressure during sudden traffic peaks. For example, if many daily jobs are scheduled to start at the same time, the concurrent load can crash the backend system if not properly controlled. To address this issue, SchedulerX introduces a queue mechanism that controls the maximum number of task instances that can run concurrently within an application. By queuing and dispatching jobs sequentially, this mechanism ensures the application remains stable and uses resources efficiently.
Configuration
Enable throttling and set a queue size
-
When you create or edit an application group, enable the Flow Control switch in the advanced configuration section. This switch is disabled by default. For more information about how to create an application group, see Create an application group.
After you enable flow control, you can set the Number of concurrent task instances. This parameter defines the maximum number of task instances that can run simultaneously for the application. If the number of submitted task instances exceeds this limit, excess instances are queued for later execution.
-
Create three jobs in the application group and click Run once in the Actions column for each job.
-
In the left-side navigation pane, click Execution List. On the Task instance List tab, you can see that the first job triggered, hello_jobA, is running, while hello_jobB and hello_jobC are waiting in the queue.
-
After hello_jobA runs successfully, hello_jobB starts running.
Configure a preemptive priority queue
Resource management systems like YARN (Yet Another Resource Negotiator) use priority queues to isolate resources for jobs with different priorities.
The following procedure shows how SchedulerX combines application-level throttling with job priorities to implement a priority queue that supports preemption.
-
SchedulerX lets you assign a priority to each job. Within the same application, if multiple jobs are scheduled for the same time, SchedulerX schedules higher-priority jobs first.
On the Basic Configuration page for a job, you can select a priority from the dropdown list: low, medium, high, or very high.
-
To demonstrate this, enable flow control for the
dts-all.hxmapplication group and set the Number of concurrent task instances to 1 for clarity. Create three jobs with high, medium, and low priorities. Then, trigger the jobs once in the following order: medium, low, and high. -
In the left-side navigation pane, click Execution List. On the Task instance List tab, you can see that when the medium-priority job is triggered, it runs immediately because the execution queue is empty.
-
After the medium-priority job completes, an execution slot becomes available. The high-priority job preempts the low-priority job and runs next.
FAQ
-
If I set the priority for all my jobs to very high, will they be scheduled before jobs from other users?
Job priority is an application-level setting. It affects the scheduling order of jobs only within the same application and does not affect other applications.
-
Can I use queue-based throttling for jobs that run every minute?
This feature is ideal for scenarios with sudden traffic spikes. If you have a high volume of jobs scheduled every minute, we do not recommend using this feature because it can cause the queue to grow indefinitely. In such cases, consider implementing business-level throttling on the client or scaling up your client resources.