Designing Batch Workloads with Azure Batch
This lesson explains Azure Batch and the alternatives for batch work.
Learning outcomes
After completing this lesson, you will be able to:
- Describe Batch accounts, pools, jobs and tasks.
- Explain how pool design controls cost.
- Choose a service for a batch workload.
What batch processing is
Batch workloads run without user interaction, for a limited period, often across many machines. Examples include rendering frames, running risk simulations, transcoding video and processing genomic data. These workloads are frequently intrinsically parallel, meaning each task can run independently, or tightly coupled, meaning tasks must exchange data during execution through a high-speed network.
Azure Batch
Azure Batch runs large-scale parallel and high-performance computing jobs. The service manages a pool of virtual machines, installs applications, schedules tasks and retries failures, so the customer needs no cluster software of their own. It has no additional service charge: the customer pays for the underlying compute and storage.
A Batch design has a small number of concepts. A Batch account is the top-level resource. A pool is a collection of compute nodes of a chosen size. A job is a collection of tasks that runs on a pool. A task is a unit of work, usually a command line.
-
Upload input
Input files and the application are placed in Azure Storage.
-
Create a pool
Choose the node size and scaling rules, and use Spot nodes where interruption is acceptable.
-
Submit a job
A client application creates a job with one task per unit of work.
-
Run and monitor
Batch assigns tasks to nodes, and retries failed tasks automatically.
-
Collect output
Tasks write results to Azure Storage, and the pool scales down.
Batch concepts
Designing the pool
The pool drives cost and performance. An autoscale formula can scale a pool to the number of pending tasks, and scale it to zero after work completes. Spot nodes greatly reduce cost, and if a node is evicted, Batch requeues its tasks, so work continues on other nodes. A mix of dedicated and Spot nodes offers a balance between cost and a guaranteed finish.
Tightly coupled workloads need HPC sizes with InfiniBand networking, such as the HB and HX families, and Batch can run Message Passing Interface (MPI) applications across such nodes. For intense parallel file access, Azure Managed Lustre can supply the storage, with Blob Storage for input and output.
The following diagram follows a nightly risk model run on Azure Batch.

Designing a Batch pool
Other options for batch work
Azure Batch is not the only way to run a job. The right tool depends on the shape of the work.
| Requirement | Service |
|---|---|
| Large-scale parallel or HPC jobs across many virtual machines | Azure Batch |
| Containerized jobs that finish, with low operational effort | Azure Container Apps jobs |
| Short, event-driven processing | Azure Functions, with Durable Functions for coordination |
| Large-scale data transformation with Spark | Azure Databricks or Microsoft Fabric |
| Scheduling data movement and transformation | Azure Data Factory |
| Jobs that run on an existing Kubernetes platform | Kubernetes Jobs on AKS |
Which batch tool?
Applications, containers and storage
Batch needs a way to place software on its nodes. Application packages are versioned zip files that Batch deploys to the pool. A start task runs when a node joins a pool, and it is the place to install dependencies. Container tasks run each task in a Docker image, so that dependencies are packaged consistently, and images are pulled from Azure Container Registry. Custom images from an Azure Compute Gallery shorten start-up when installation is slow.
Data should stay close to compute, as input and output often dominate run time. Blob Storage is the usual store, and resource files download input to each node. A storage account in the same region avoids transfer charges and latency. Tasks should be designed to be idempotent, and to write results atomically, since a requeued task runs again from the beginning.
Reliability and identity
Large jobs must expect failure. Batch retries a failed task up to a configured number of times, and a task that keeps failing can be detected through monitoring rather than blocking a whole job. Task dependencies allow a task to wait for others, which supports multi-stage work, such as splitting input, processing parts and merging results.
Batch accounts offer two pool allocation modes. Batch service mode keeps nodes in a Microsoft-managed subscription, which is simple. User subscription mode creates virtual machines in the customer's own subscription, which is useful for reserved instances and for certain network requirements. Managed identities on a pool allow tasks to reach storage and Key Vault with no stored secrets, in line with the identity guidance elsewhere in this course.
Running a simulation
An insurer runs a risk model each night, consisting of 200,000 independent simulations, each taking about 10 minutes on one core. The results are needed by 7 a.m., and the application is a command-line executable. Costs must be minimized, and no servers should remain running during the day. What should you recommend?
Azure Batch fits well: each simulation becomes a task, the command-line tool needs no rewriting, and Batch handles scheduling and retries. Autoscale reduces the pool to zero when work ends, and Spot nodes reduce cost, with some dedicated nodes to guarantee completion by the deadline.
Azure Functions would need rewriting, and a Flex Consumption instance is less suitable for hours of intensive CPU work across 200,000 tasks. A permanently running HPC cluster on virtual machines would waste money during the day, and App Service is a hosting service for web workloads rather than for batch jobs.
What happens to a task on a Spot node that is evicted?
Show answer
Batch requeues the task, so that it runs again on another node.
Exam Tips
Remember for the exam
- Batch concepts: account, pool, job and task.
- Batch has no service charge; pay for compute and storage.
- Spot nodes reduce cost; evicted tasks are requeued.
- Tightly coupled work needs InfiniBand sizes such as HB and HX.