Manage sizing and scaling for containers

Provision and manage containers in Azure

📘Microsoft Certified: Azure Administrator Associate (AZ-104)


When you deploy containers in Azure, you need to think about how much computing power they need and how they handle changing workloads. This is where sizing and scaling come in.

1. Container Sizing in Azure

Sizing means deciding how much CPU, memory, and storage your container will need. In Azure, this applies to both Azure Container Instances (ACI) and Azure Container Apps (ACA).

Key Points for Exam:

  • CPU and Memory:
    • Containers require CPU cores and memory (RAM).
    • Example: A small container that just serves a few internal apps might need 1 vCPU and 1 GB RAM. A container running a database might need 2 vCPU and 4 GB RAM or more.
  • Storage:
    • Containers often need storage for logs, temporary files, or persistent data.
    • Azure allows you to attach Azure Files or disks to containers for persistent storage.
  • How to Configure:
    • When creating a container in ACI, you set the CPU and memory limits.
    • In Container Apps, you can set minimum and maximum CPU/memory per container.

Tip for Exam: You must know that undersizing can make your application slow, while oversizing can waste resources and increase costs.


2. Scaling Containers in Azure

Scaling means changing the number of container instances based on demand. In IT environments, this is crucial because workloads can fluctuate:

  • Example: An internal company app might have low usage at night but high usage during business hours. Scaling ensures the app can handle the load without downtime or performance issues.

Types of Scaling:

  1. Manual Scaling
    • You manually increase or decrease the number of container instances.
    • Example: If you expect a monthly report generation to need more resources, you can manually add more container instances.
  2. Autoscaling (Automatic Scaling)
    • Azure can automatically scale containers based on CPU usage, memory usage, or custom metrics.
    • Example:
      • If CPU usage goes above 70% for 5 minutes, Azure can spin up more container instances automatically.
      • When demand drops, Azure reduces the number of instances to save costs.
  3. Scaling in Different Azure Services: ServiceScaling MethodKey PointsAzure Container Instances (ACI)Manual onlyYou can manually set the number of instances. No built-in autoscaling.Azure Container Apps (ACA)AutoscaleSupports CPU, memory, queue length, HTTP traffic, or custom metrics for autoscaling.

3. Scaling Policies and Limits

  • Minimum and Maximum Replicas:
    • You define how many container instances should always run (minimum) and the maximum allowed.
    • Example: Minimum 1 instance, maximum 10 instances.
  • Scaling Triggers:
    • CPU usage, memory usage, HTTP request count, queue length, or custom metrics.
  • Cooldown Period:
    • After scaling up or down, Azure waits for a defined period before making another scaling decision. This prevents constant scaling up and down (flapping).

4. Real IT Examples for Sizing and Scaling

  1. Web Application in ACA:
    • Base: 1 vCPU, 1 GB RAM
    • Autoscale: 1–5 instances based on HTTP traffic
  2. Data Processing Jobs:
    • Base: 2 vCPU, 4 GB RAM
    • Manual scale: Increase to 4–8 instances during heavy batch processing
  3. Message Queue Worker Container:
    • Trigger: Scale out based on queue length
    • Minimum: 1 instance, Maximum: 10 instances

5. Important Exam Points to Remember

  • Containers are lightweight and fast, but their resources must match the workload.
  • ACI: Quick, simple, manual scaling only. Good for small apps or testing.
  • ACA: More advanced, supports autoscaling and event-driven scaling.
  • Scaling is important to maintain performance and control costs.
  • Autoscaling policies use CPU, memory, HTTP requests, queue length, or custom metrics.
  • You can define minimum and maximum instances to prevent overloading or overspending.

Summary:

Managing sizing and scaling in Azure containers is about making sure your apps:

  1. Have the right CPU, memory, and storage.
  2. Can handle changes in workload by scaling manually or automatically.
  3. Are cost-efficient and high-performing.

For the exam, remember ACI = manual scaling, ACA = autoscaling, and know the scaling triggers and limits.

Leave a Reply

Your email address will not be published. Required fields are marked *

Buy Me a Coffee