Azure Container Apps, a service for running apps and microservices with serverless containers, is excited to announce the public preview of jobs. With this new feature, Container Apps now supports two types of compute resources:
- Apps are generally available and are the first type of compute resource in Azure Container Apps. They are services that continuously process input. Common examples of apps include HTTP APIs, web apps, and background services. Apps can scale dynamically to meet demand and can scale to zero when idle.
- New: Jobs are tasks with a finite lifespan — they start, perform some processing, and exit when finished. Each execution of a job typically performs a single unit of work and can run for minutes or even hours. Multiple job executions can run simultaneously. Examples of jobs include batch processes that run on demand and scheduled tasks.
You can combine apps and jobs to build powerful microservice solutions.
Jobs are a great fit for scenarios such as data processing, machine learning, or any scenario where on-demand processing is required. Jobs can communicate with other apps in the same Container Apps environment, and they share capabilities such as networking and logging.
Job trigger types
Jobs can be triggered in three ways:
- Manual jobs are triggered on-demand.
- Scheduled jobs are triggered at specific times and can run repeatedly.
- Event-driven jobs are triggered by events such as a message arriving in a queue.
Manual jobs are great when you need to execute a one-off task. For example, you might want to run a job that migrates data from one system to another. You can trigger the job manually when it's time to perform the migration.
You can also use manual jobs to run tasks that are less suited to be executed by an app. For example, you might want to run a job that performs a complex calculation in a separate container that takes several minutes to complete. You can trigger the job from an app and return a response to the client immediately. The job execution can then run in the background. It can communicate with the app to provide status updates and return the result when finished.
Scheduled jobs are useful for running tasks on a recurring schedule. For example, you might want to run a job that performs a daily backup of your database. You can schedule the job to run at a specific time each day.
Because schedules are defined as standard cron expressions, you can schedule jobs to run at almost any frequency. For example, you can schedule a job to execute every 15 minutes, every hour, or every Tuesday at 3:00 AM.
Sometimes you need to run a task in response to an event. For example, you might want to run a job that processes a message that arrives in a queue. You can configure an event-driven job to start automatically when a message arrives in the queue.
Azure Container Apps integrates with the open-source KEDA project to scale apps based on events. KEDA is also the engine that powers event-driven jobs. You can trigger job executions based on supported KEDA scalers, including Azure Service Bus, Azure Event Hubs, Azure Storage Queues, Azure Storage Blobs, RabbitMQ, Kafka, and more.
Cost-effective serverless compute
Just like container apps, jobs are billed by the second based on the amount of memory and CPU used during execution when you run them in the Consumption plan. You can also run them in the Dedicated plan.
Try Azure Container Apps jobs today
Jobs are available in all regions where Azure Container Apps is available. See the documentation to get started: