MapReduce model
The MapReduce model is a lightweight, distributed batch processing model developed by SchedulerX. It uses the MapJobProcessor or MapReduceJobProcessor interface to organize connected workers into a distributed computing engine for big data batch processing. Compared to traditional big data batch processing on platforms such as Hadoop and Spark, the SchedulerX MapReduce model can process massive amounts of data in seconds without importing the data into a big data platform, and without extra storage or computing costs. It is low-cost, fast, and easy to program.
Notes
-
A single subtask cannot exceed 64 KB in size.
-
The
resultreturned byProcessResultcannot exceed 1,000 bytes. -
If you use the
reducemethod, the results of all subtasks are cached on the master node, causing high memory pressure. Keep the number of subtasks and the size of the returnedresultsmall. If you do not need thereducefunctionality, use theMapJobProcessorinterface. -
SchedulerX does not guarantee exactly-once execution for subtasks. In certain failover conditions, a subtask may be executed more than once. Your application must handle this by being idempotent.
Interfaces
Extend the MapJobProcessor class
|
API |
Description |
Required |
|
|
The entry point for executing the business logic of each subtask. You must retrieve the task name from the context to handle the subtask accordingly. After the logic is executed, return a ProcessResult. |
Yes |
|
|
Call the map method to distribute a batch of subtasks across multiple machines for execution. This method can be called multiple times. If taskList is empty, the operation fails. After execution is complete, return a ProcessResult. |
Yes |
|
|
Killing a job in the console triggers this method. You must implement the logic to interrupt your business process. |
No |
Extend the MapReduceJobProcessor class
|
API |
Description |
Required |
|
|
The entry point for executing the business logic of each subtask. You must retrieve the task name from the context to handle the subtask accordingly. After the logic is executed, return a ProcessResult. |
Yes |
|
|
Call the map method to distribute a batch of subtasks across multiple machines for execution. This method can be called multiple times. If taskList is empty, the operation fails. After execution is complete, return a ProcessResult. |
Yes |
|
|
After all subtasks on the worker nodes complete execution, the system calls the The
|
Yes |
|
|
Killing a job in the console triggers this method. You must implement the logic to interrupt your business process. |
No |
|
|
Specifies whether to execute the |
No |
Procedure
-
Log in to the MSE SchedulerX console. In the left-side navigation pane, click Task Management.
-
On the Task Management page, click Add Task.
-
In the Add Task panel, select MapReduce from the Execution Mode drop-down list and configure the parameters in the Advanced Configuration section.
Parameter
Description
Distribution Policy
NoteRequires client version 1.10.3 or later.
-
Polling Policy (Default): Distributes an equal number of subtasks to each worker. This policy is suitable for scenarios where each subtask takes a similar amount of time to process.
-
Optimal Load Strategy: The master node automatically detects the load on each worker node. This policy is suitable for scenarios where processing times vary significantly across subtasks and worker machines.
Subtask Concurrency per Node
The number of concurrent execution threads on a single worker. The default is 5. Increase this value to speed up execution. If downstream systems or your database cannot handle the increased load, you can decrease this value.
Subtask Failure Retry Count
The number of times to automatically retry a failed subtask. The default is 0.
Subtask Failure Retry Interval
The interval, in seconds, between retry attempts for a failed subtask. The default is 0.
Failover Policy
NoteRequires client version 1.8.12 or later.
Specifies whether to redistribute subtasks from a failed node to other machines. If you enable this option, subtasks might be re-executed during failover. Your application must therefore be idempotent.
Execute on Master Node
NoteRequires client version 1.8.12 or later.
Specifies whether the master node participates in subtask execution. There must be at least two online workers. Disable this option when the number of subtasks is very large.
Subtask Distribution Method
-
Push model: Subtasks are evenly distributed to each machine.
-
Pull model: Each machine actively pulls subtasks. This model avoids bottlenecks caused by slower workers and supports dynamic scaling. During this process, all subtasks are cached on the master node, increasing memory pressure. We recommend that the number of subtasks does not exceed 10,000.
For information about other configuration items, see Advanced configuration parameters for job management.
-
Principles and best practices
How SchedulerX 2.0 distributed computing works and its best practices