These are the current out of the box Autoscale settings. You may find better settings to fit your needs. This document explains how this can be accomplished.
The Azure Functions Service Plan Autoscale settings are defined in the file located at /infra/core/host/functions/functions.tf
. These settings enable automatic scaling of the Azure Functions Service Plan based on CPU usage metrics.
File Location: /infra/core/host/functions/functions.tf
-
Increase Capacity Rule:
- Metric:
CpuPercentage
- Operator:
GreaterThan
- Threshold:
60%
- Time Window:
5 minutes
- Scaling Action: Increase capacity by
2
with a cooldown of5 minutes
.
- Metric:
-
Decrease Capacity Rule:
- Metric:
CpuPercentage
- Operator:
LessThan
- Threshold:
40%
- Time Window:
5 minutes
- Scaling Action: Decrease capacity by
2
with a cooldown of2 minutes
.
- Metric:
The App Service Plan Autoscale settings for the enrichment app are defined in the file located at /infra/core/host/enrichmentapp/enrichmentapp.tf
. These settings enable automatic scaling of the App Service Plan based on CPU usage metrics.
File Location: /infra/core/host/enrichmentapp/enrichmentapp.tf
-
Increase Capacity Rule:
- Metric:
CpuPercentage
- Operator:
GreaterThan
- Threshold:
60%
- Time Window:
5 minutes
- Scaling Action: Increase capacity by
1
with a cooldown of5 minutes
.
- Metric:
-
Decrease Capacity Rule:
- Metric:
CpuPercentage
- Operator:
LessThan
- Threshold:
20%
- Time Window:
10 minutes
- Scaling Action: Decrease capacity by
1
with a cooldown of15 minutes
.
- Metric:
To customize the App Service Plan Autoscale settings, modify the parameters mentioned above in the specified terraform files. And Run the make infrastructure
command.
The SKU settings for all Service Plans are defined in the file located at /infra/variables.tf
. The SKU (Stock Keeping Unit) represents the pricing tier or plan for your App Service. It defines the performance, features, and capacity of the App Service.
More information can be found here.
File Location: /infra/variables.tf
- appServiceSkuSize
S1
- appServiceSkuTier
Standard
File Location: /infra/variables.tf
- functionsAppSkuSize
S2
- functionsAppSkuTie:
Standard
File Location: /infra/variables.tf
- enrichmentAppServiceSkuSize
P1v3
- enrichmentAppServiceSkuTier
PremiumV3
There exist a property that can be set in the local.env file called DEQUEUE_MESSAGE_BATCH_SIZE
and is defaulted in the infra/main.tf
and app/enrichment/app.py
to the value of 3. This means the app will process 3 messages from the queue at a time. This is found to be the most optimal with the existing configuration but can be increased if you also increase the enrichment app service SKU. It is important to note that there will be issues if it is increased more than the app service SKU can handle.
To customize the App Service Plans SKU settings, modify the sku
parameters in the specified Terraform file and run the make deploy
or make infrastructure
command.
This can also be adjusted in the Azure Portal.
Note: Adjusting the scale or Tier can cause outages until the redeployment occurs.
- Sign in to the Azure Portal:
- Open a web browser and navigate to the Azure Portal.
- Log in with your Azure account credentials.
- Navigate to the App Service:
- In the left navigation pane, select "App Services."
- Click on the specific App Service you want to scale.
- Access the Scale Up Blade:
- In the App Service menu, find and click on "Scale up (App Service plan)" in the left sidebar.
- Choose a New Pricing Tier:
- On the "Scale Up" blade, you'll see different pricing tiers representing various levels of resources.
- Select the desired pricing tier that corresponds to the scale you need.
- Review and Apply Changes:
- Review the information about the selected pricing tier, including its features and costs.
- Click the "Apply" or "Save" button to apply the changes.
-
Cost Implications:
- Be aware of the cost implications associated with higher pricing tiers. Review the Azure Pricing documentation for details on costs.
-
Resource Limits:
- Ensure that the new pricing tier aligns with the resource requirements of your application. Some tiers may have limitations on resources.
-
Performance Impact:
- Scaling up provides additional resources, potentially improving performance. However, it's essential to assess whether your application benefits from the increased resources.