Search code examples
azureazure-functionsazure-cosmosdbscaleazure-application-insights

Monitor scale on Azure


I have a request pipeline that goes app-service > app-service > cosmosDB (then returns). We are currently in performance testing for said pipeline and hitting it with about 10k requests per minute. Something that we've noticed is that the longer the test goes on, the worse performance gets, so our response was to enable autoscale on the app services and on cosmosDB. Unfortunately, this hasn't impacted performance, and I'd like to see if the autoscale is even working.

TL;DR

Is there a log for how many instances of a resource are active [from autoscale] at a given time?


Solution

  • Is there a log for how many instances of a resource are active [from autoscale] at a given time?]

    Thanks @MarkBrown for the Comment.

    I have created Azure App Service and enabled auto scale based on the request’s metric rule. enter image description here

    The dotted line shows the maximum request that will enable additional instances of app service whenever the web app reaches request of 70.53%. Blue line shows the current requests of the web app.

    enter image description here

    Whenever the app reaches 70% increase the count by 1 with maximum instances up to 4

    enter image description here

    • Added another rule for scale in enter image description here

    • We can see the capacity is still 1. Run the load test on Web App. You can see App service is scaled up to 3 instances after load test. enter image description here

    enter image description here

    • Check the Auto Scale history.

    enter image description here

    • View the Web apps activity history in Azure monitor =>Activity Log. enter image description here

    Autoscaling in Cosmos DB

    • In Azure Cosmos DB Number of Ru’s are scaled. We can mention the max number of RU’s required for our Cosmos DB.

    Enabling Autoscale for the CosmosDB

    • Navigate to your Azure Cosmos DB Account => Scale => New Container.

    enter image description here

    • Cosmos DB will scale from 5000 to 1/10th of its value (500-5000 RU's). If we work for more hours, scale will be up to the mark. When our workload is not running, we can scale down to less RU's.

    Check the consumption of RU’s in Metrics

    enter image description here

    • Currently the percentage is 14%, Normalized RU consumption chart varies between 0-100 % and it gives information on how much of the current throughput we have provisioned and is utilized.
    • 100% means max RU that we have mentioned. If our consumption in the above chart is linear and above 66% on average, we don’t need autoscaling, if it is variable, we need to auto scale.

    And how to check how many instances does cosmos dB has scaled to after enabling auto scale?

    Provisioned Throughput is the instances or scaling that cosmos dB has done. In the chart below auto scale has provisioned 500 throughputs

    Auto scale max throughput – 1k

    Provisioned Throughput- 500k

    enter image description here

    • We can also send Azure cosmos DB logs to log analytics to query and get additional insights.

    enter image description here

    enter image description here