Which Azure Container Service should I pick to execute jobs?
There are many different types of container services in Azure, and Azure Container Instances (ACI) is probably the best one to run jobs. This service is part of the serverless offering and is particularly well suited for jobs for the following reasons:
- You pay per second of execution; once the job completes, you stop paying
- You can allocate up to 4CPU and 16GB of RAM, depending on the region, per job
- You can create and destroy them programmatically or through other Azure services such as Logic Apps
- You can run up to 100 instances in parallel, which might be required in peak times. The default limit of 100 concurrent instances can be increased
- It integrates with the Hub & Spoke topology, although there are still some limitations
If you use Azure CNI for your Azure Kubernetes Services (AKS) clusters, you can extend them with ACIs, which run as Virtual Kubelets. In such a case, you not only benefit from the same advantages as the ones listed above but also:
- AKS itself entirely manages their lifecycle
- They are convenient when you must execute memory-intensive containers. As you might know, memory cannot be throttled. Consequently, containers might be prevented from starting if AKS does not find the required memory.
- They are also of great value when used as event handlers in asynchronous scenarios, where completion time does not matter too much.
The latter is essential because, as with many serverless services, ACIs take some time to get started since they pull their image every time they start. So, the last tip to conclude is to work with as few images as possible.