Share via

Azure Container App Max Allocated CPU is 4, but only use 2 at most

sangyeob 90 Reputation points
2025-07-18T00:16:54.5233333+00:00

Hello,

I am currently using Azure Container Apps to run my service. I set the resource of container app with 4 allocated CPU cores and 8 Gi of memory.

Here are the relevant settings:

  • Environment type: Workload Profiles
  • Workload profile name: Consumption
  • CPU cores allocated: 4
  • Memory size: 8 Gi

However, during high-load situations, I noticed that the app only utilizes up to 2 CPU cores, even though 4 cores are allocated.

I’ve attached a screenshot from the Azure Managed Grafana dashboard of the containerapp. It shows the max allocated CPU is shown correctly as 4.0 cores. but the average CPU usage never exceeds 2 cores.

User's image

I expected the application to be able to use the full 4 cores when needed, but this doesn't seem to be the case.

Azure Container Apps
Azure Container Apps

An Azure service that provides a general-purpose, serverless container platform.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Mr Humayun 155 Reputation points
    2025-07-18T13:50:14.5+00:00

    Thank you for the additional context! Since you've confirmed that the application is designed to utilize multiple cores, and you've also verified that the same configuration works well on an on-premise Kubernetes cluster, it's likely that there are some Azure-specific factors impacting your CPU usage. Let me help you troubleshoot further with a focus on Azure Container Apps and possible configurations that might limit CPU usage.

    Potential Azure Container App Configuration Limitations:

    1. CPU Limits Based on Container Size and Plan:

    Even though you've allocated 4 CPU cores in the configuration, the Consumption plan (which you're using) can sometimes be less predictable with regard to resource limits. While it's designed to auto-scale based on demand, it may not always utilize the full resources allocated if the load does not meet specific conditions.

    To address this, try switching your app to a Premium or Dedicated plan. These plans are designed to offer more consistent resource availability and better scaling capabilities. With these plans, you may be able to achieve more reliable CPU core usage for your app.

    2. Concurrency and Scaling Behavior:

    You mentioned that you're using the ScaleRule: Http Requests (concurrency 10) and the scaling is set to a minimum and maximum replica of 1. This means that even under high load, only 1 replica of your container will run, and it may not be able to fully utilize the 4 cores, as Azure Container Apps won't scale beyond 1 replica.

    If you want to fully utilize 4 cores, the app will need to be able to scale. Consider adjusting the minReplicas and maxReplicas to values higher than 1, such as:

    minReplicas: 1

    maxReplicas: 4

    ScaleRule: Http Requests (concurrency 10)

    This would allow the app to scale up to 4 replicas, which could better leverage the available CPU cores when needed.

    3. Container Resource Allocation (CPU and Memory):

    Double-check the actual resource allocation for CPU and memory in the container. In some cases, the CPU allocation within the container itself may not be set up properly. While you have allocated 4 cores in the app configuration, make sure your container's resource definition (in the Dockerfile or Kubernetes manifest) doesn't limit CPU usage.

    You can confirm this by checking the container's resource requests and limits. For instance, if your container has resource limits that conflict with the allocated CPU cores (such as a max limit of 2 cores), it could restrict the app's ability to use the full 4 cores.

    4. Environment-Specific Resource Bottlenecks:

    Azure may impose certain resource limits on Consumption plan containers to prevent abuse or excessive resource consumption. These limits could affect how the CPU resources are distributed. If you're hitting an Azure-specific resource cap or throttling mechanism, you might see reduced CPU usage. Moving to the Premium plan (as mentioned earlier) will give you more consistent access to your allocated resources.

    5. Node Pool Resource Constraints:

    Azure Container Apps runs on a set of underlying infrastructure. It's possible that the node pool on which your container is deployed has resource constraints that prevent it from utilizing the full CPU allocation. You can check the underlying node pool's available resources and ensure it's capable of handling the required number of cores.

    6. Azure Resource Throttling or Scheduling Delays:

    In some cases, Azure might throttle or delay resource allocation, especially in the Consumption plan. If the scaling behavior seems inconsistent, Azure could be delaying the allocation of additional resources due to system load or availability, which could explain why your app doesn't utilize the full CPU allocation immediately.

    Further Steps:

    Switch to Premium Plan: Move to a Premium plan or test the app in a Dedicated plan. This will help ensure that the app has consistent access to allocated CPU cores without the constraints of the Consumption plan.

    Adjust Scaling Rules: Increase the maxReplicas to scale beyond a single instance, which might allow the app to fully utilize the allocated resources.

    Review Resource Allocation in Container Definition: Ensure that the CPU and memory limits within the container itself are aligned with the Azure configuration (i.e., check for any resource limits set within the Dockerfile or Kubernetes deployment).

    Please feel free to reach out if you need further clarification or assistance with any of these steps!

    Was this answer helpful?

    0 comments No comments

  2. Mr Humayun 155 Reputation points
    2025-07-18T00:49:55.6633333+00:00

    Hi sangyeob, It seems that your Azure Container App is not utilizing the full 4 allocated CPU cores during high-load situations. This can happen due to several reasons, and I will walk you through a few things to check and adjust:

    1. App Scaling Settings: Azure Container Apps, especially when set to the Consumption workload profile, dynamically scale based on the demand. This could mean that your app isn't reaching a high enough load to trigger the use of all 4 cores. You can review the scaling settings and adjust the scaling rules to ensure that the container is given more resources when the load increases. Consider checking the Scaling rules under your container app's configuration to ensure it scales properly.
    2. CPU Usage Limitations: Even if you allocate 4 CPU cores, the actual CPU usage can be constrained by the application itself. Ensure your application is optimized and is capable of handling the full resources allocated. If the app is single-threaded or not designed to take advantage of multiple cores, it may not scale up its usage of the allocated CPU cores.
    3. Resource Limits in Application Code: The application might have internal limits or configurations that prevent it from utilizing more than 2 cores. Check if there are any resource or process management settings within the app that might be restricting CPU utilization. For instance, if your app uses multi-threading, ensure it's properly implemented to distribute the workload across multiple cores.
    4. Monitor Metrics More Closely: It might be useful to monitor the actual CPU usage metrics over a longer period to see if there's a spike at specific times that could help identify if the app is truly not using the available resources or if it's just a case of it not reaching peak usage.
    5. Azure Diagnostics Logs: You can enable more detailed diagnostics to monitor CPU, memory, and scaling metrics. This will give you insights into whether there’s an issue with the scaling process or if the application is underperforming due to internal limitations.
    6. Container App Configuration Review: Double-check your configuration settings for Azure Container Apps. If you're using Limitations on CPU or Memory usage within the app (such as specific quotas), ensure that these don't limit the container's ability to scale. You might also want to check if there are any container-specific configurations that limit CPU usage.

    Let me know if you need further assistance!

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.