Serverless & Batch Processing
Azure Functions, Logic Apps, and Azure Batch โ design event-driven and batch compute solutions that scale automatically and charge only for what you use.
Serverless and batch compute design
Serverless means you write code, Azure handles everything else. No servers to provision, no capacity to plan โ just code that runs when triggered.
Azure Functions: Code triggered by events (HTTP request, timer, queue message, file upload). Runs, charges, stops.
Logic Apps: Visual workflows connecting 400+ services. No code needed โ drag-and-drop integration.
Azure Batch: Run thousands of parallel tasks on a pool of VMs. For heavy compute jobs (rendering, simulation, scientific computing).
Azure Functions hosting plans
| Factor | Consumption (Legacy) | Flex Consumption | Premium | Dedicated (App Service) |
|---|---|---|---|---|
| Scaling | Auto (event-driven) | Auto (fast, per-function) | Auto (pre-warmed instances) | Manual/auto (App Service rules) |
| Scale to zero | Yes | Yes | No (min 1 instance) | No |
| Cold start | Yes (seconds) | Reduced | No (always warm) | No |
| Execution timeout | 5 min default (10 max) | Configurable | Unlimited | Unlimited |
| VNet integration | No | Yes | Yes | Yes |
| Min cost | Free (1M executions/mo) | Pay per execution | ~$175/mo (1 instance) | App Service plan cost |
| Status | Legacy โ being superseded | Recommended for new serverless | Production APIs, low-latency | Existing App Service plan reuse |
| Best for | Existing apps only โ migrate to Flex | Variable traffic with fast scale | Production APIs, low-latency | Existing App Service plan reuse |
Functions vs Logic Apps
| Factor | Azure Functions | Logic Apps (Standard) |
|---|---|---|
| Development | Code-first (C#, JS, Python, Java, PowerShell) | Visual designer + code-behind |
| Triggers | HTTP, timer, queue, blob, Event Grid, etc. | 400+ connectors (Office 365, Salesforce, SAP, etc.) |
| Orchestration | Durable Functions for complex workflows | Built-in workflow engine (loops, conditions, parallel) |
| Integration focus | Custom code execution | Service-to-service integration (SaaS connectors) |
| Best for | Custom code triggered by events | Business process automation, SaaS integration |
๐๏ธ Davidโs pattern: CloudPath Advisory uses both:
- Functions for custom processing (transform data, call APIs, compute)
- Logic Apps for integration workflows (sync Dynamics โ SharePoint โ email notifications)
- Durable Functions for long-running orchestrations (approval workflows with human interaction)
Azure Batch for large-scale compute
| Feature | Description |
|---|---|
| Pool of VMs | Create managed pools (Linux/Windows, any size, spot VMs for cost savings) |
| Task scheduling | Submit thousands of tasks โ Batch distributes across pool nodes |
| Auto-scale | Scale pool based on queue depth or schedule |
| Job dependencies | Task B waits for Task A to complete |
| MPI support | Tightly coupled parallel workloads (HPC, scientific simulation) |
| Use Case | Example | Why Batch |
|---|---|---|
| Video rendering | Render 10,000 video frames in parallel | Each frame = independent task, embarrassingly parallel |
| Financial modelling | Run 50,000 Monte Carlo simulations | Each simulation = independent, aggregated at end |
| Genomics | Process 100,000 DNA sequences | Parallel processing with spot VMs for cost |
๐๏ธ Priyaโs batch design: GlobalTechโs nightly reporting:
- Azure Batch pool with D4s_v5 spot VMs (90% cheaper than on-demand)
- 500 report generation tasks distributed across pool
- Auto-scale: Pool starts at 0 VMs, scales to 50 during batch window, scales back to 0
- Cost: ~$15/night vs $2,400/month for always-on VMs
Exam tip: Functions vs Batch โ execution duration is the key
Functions: Short-duration tasks (seconds to minutes). Event-driven. Consumption plan has a 10-minute max.
Batch: Long-duration tasks (minutes to hours). Scheduled or on-demand. No execution time limit.
If the scenario says โprocess millions of items that each take 30 secondsโ โ Functions with queue trigger. If it says โeach task takes 2 hoursโ โ Azure Batch.
Knowledge check
๐๏ธ GlobalTech needs to generate 500 PDF reports every night. Each report takes 3-5 minutes to render. The job should start at midnight and use the cheapest compute possible. Which solution should Priya recommend?
๐๏ธ GlobalTech needs to process new employee onboarding: (1) create AD account, (2) provision mailbox, (3) assign licences, (4) wait for manager approval, then (5) grant access to team resources. Steps 1-3 can run in parallel, but step 5 must wait for step 4. The approval may take up to 7 days. Which solution should Priya recommend?
๐ฌ Video coming soon
Next up: How services talk to each other โ Messaging Architecture.