A task is the basic computing unit in MaxCompute. When you submit a SQL or MapReduce program, MaxCompute converts it into one or more tasks and runs them in parallel across a distributed environment.
Execution layers
MaxCompute organizes submitted programs into three layers:
| Layer | Description |
|---|---|
| Program | The SQL or MapReduce code you write and submit. |
| Task | The internal representation MaxCompute creates to execute your program. Most tasks that you submit — especially computing tasks such as SQL DML statements and MapReduce tasks — go through this layer. SQL DDL statements are tasks, but not computing tasks; they only read or modify MaxCompute metadata, and MaxCompute cannot generate execution plans for them. |
| Instance | The running form of a computing task. When a task executes, it becomes an instance. Run the status command to check the instance state, or the kill command to stop it. |
Not all requests become tasks. Operations on projects, resources, user-defined functions (UDFs), and instances are handled directly, without creating a task.
Execution model
For computing tasks, MaxCompute parses the submitted program and generates an execution plan. The execution plan is a directed graph:
-
Each vertex in the graph represents a stage.
-
Each edge represents a dependency between stages.
-
MaxCompute executes stages in dependency order.
Within a stage, multiple workers (processes) run in parallel. All workers in a stage apply the same execution logic but process different data. Workers are the actual processes that carry out computation — a stage defines what to do, and workers do it.
Concept reference
| Concept | Description |
|---|---|
| Task | The basic computing unit. Created when you submit a SQL DML statement or MapReduce program. SQL DDL statements are tasks but not computing tasks. |
| Execution plan | A directed graph MaxCompute generates to describe how a task runs. Consists of stages connected by dependencies. Only computing tasks have execution plans. |
| Stage | A node in the execution plan. Defines a unit of computation that runs as a set of parallel workers. |
| Worker | A process within a stage. Processes a portion of the data using the stage's execution logic. |
| Instance | The running form of a computing task. Supports status and kill operations. |
Next steps
-
Use the
EXPLAINstatement to inspect the execution plan for a SQL DML statement. See EXPLAIN. -
Monitor and manage instances with the
statusandkillcommands.