From 17476f0ef34c5c1da51c53aa0bc8bdf7f75e476b Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Wed, 6 Dec 2023 22:30:58 +0000 Subject: [PATCH 01/14] Test sku and autoscale changes in automation --- infra/core/host/funcserviceplan.bicep | 57 +++++++++++++++++++++++++++ infra/main.bicep | 4 +- 2 files changed, 59 insertions(+), 2 deletions(-) diff --git a/infra/core/host/funcserviceplan.bicep b/infra/core/host/funcserviceplan.bicep index 72ae143b6..2201d1b09 100644 --- a/infra/core/host/funcserviceplan.bicep +++ b/infra/core/host/funcserviceplan.bicep @@ -17,5 +17,62 @@ resource funcServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { } } +resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2022-10-01' = { + name: '${funcServicePlan.name}-Autoscale' + location: location // Change to your desired region + properties: { + enabled: true + profiles: [ + { + name: '${funcServicePlan.name}-Autoscale' + capacity: { + default: '3' + minimum: '3' + maximum: '10' + } + rules: [ + { + metricTrigger: { + metricName: 'CpuPercentage' + metricResourceUri: funcServicePlan.id //'${functionApp.id}/providers/microsoft.insights/metrics' + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT5M' + timeAggregation: 'Average' + operator: 'GreaterThan' + threshold: 50 + } + scaleAction: { + direction: 'Increase' + type: 'ChangeCount' + value: '3' + cooldown: 'PT5M' + } + } + { + metricTrigger: { + metricName: 'CpuPercentage' + metricResourceUri: funcServicePlan.id //'${functionApp.id}/providers/microsoft.insights/metrics' + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT5M' + timeAggregation: 'Average' + operator: 'LessThan' + threshold: 40 + } + scaleAction: { + direction: 'Decrease' + type: 'ChangeCount' + value: '1' + cooldown: 'PT2M' + } + } + ] + } + ] + targetResourceUri: funcServicePlan.id + } +} + output id string = funcServicePlan.id output name string = funcServicePlan.name diff --git a/infra/main.bicep b/infra/main.bicep index a1128e088..cd5721ce9 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -157,8 +157,8 @@ module funcServicePlan 'core/host/funcserviceplan.bicep' = { location: location tags: tags sku: { - name: 'S3' - capacity: 5 + name: 'S2' + capacity: 2 } kind: 'linux' } From 9b04c3965720e1517509099dd536bdb7db59f43c Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 7 Dec 2023 21:37:22 +0000 Subject: [PATCH 02/14] Function Autoscale testing --- .../src/components/filepicker/file-picker.tsx | 26 ++++++++++++++++--- infra/core/host/funcserviceplan.bicep | 16 ++++++------ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/app/frontend/src/components/filepicker/file-picker.tsx b/app/frontend/src/components/filepicker/file-picker.tsx index f8473a9ec..e4387e982 100644 --- a/app/frontend/src/components/filepicker/file-picker.tsx +++ b/app/frontend/src/components/filepicker/file-picker.tsx @@ -22,19 +22,39 @@ const FilePicker = ({folderPath, tags}: Props) => { const folderName = folderPath; const tagList = tags; + // // handler called when files are selected via the Dropzone component + // const handleOnChange = useCallback((files: any) => { + // let filesArray = Array.from(files); + + // filesArray = filesArray.map((file) => ({ + // id: nanoid(), + // file + // })); + + // setFiles(filesArray as any); + // setProgress(0); + // setUploadStarted(false); + // }, []); + // handler called when files are selected via the Dropzone component const handleOnChange = useCallback((files: any) => { + if (files.length > 40) { + // Show an error message or handle this situation as you see fit + alert("You can only upload up to 40 files at a time."); + return; + } + let filesArray = Array.from(files); filesArray = filesArray.map((file) => ({ id: nanoid(), file - })); - + // rest of your code... + })); setFiles(filesArray as any); setProgress(0); setUploadStarted(false); - }, []); +}, []); // handle for removing files form the files list view const handleClearFile = useCallback((id: any) => { diff --git a/infra/core/host/funcserviceplan.bicep b/infra/core/host/funcserviceplan.bicep index 2201d1b09..4379b8285 100644 --- a/infra/core/host/funcserviceplan.bicep +++ b/infra/core/host/funcserviceplan.bicep @@ -19,40 +19,40 @@ resource funcServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2022-10-01' = { name: '${funcServicePlan.name}-Autoscale' - location: location // Change to your desired region + location: location properties: { enabled: true profiles: [ { name: '${funcServicePlan.name}-Autoscale' capacity: { - default: '3' - minimum: '3' + default: '2' + minimum: '2' maximum: '10' } rules: [ { metricTrigger: { metricName: 'CpuPercentage' - metricResourceUri: funcServicePlan.id //'${functionApp.id}/providers/microsoft.insights/metrics' + metricResourceUri: funcServicePlan.id timeGrain: 'PT1M' statistic: 'Average' timeWindow: 'PT5M' timeAggregation: 'Average' operator: 'GreaterThan' - threshold: 50 + threshold: 60 } scaleAction: { direction: 'Increase' type: 'ChangeCount' - value: '3' + value: '2' cooldown: 'PT5M' } } { metricTrigger: { metricName: 'CpuPercentage' - metricResourceUri: funcServicePlan.id //'${functionApp.id}/providers/microsoft.insights/metrics' + metricResourceUri: funcServicePlan.id timeGrain: 'PT1M' statistic: 'Average' timeWindow: 'PT5M' @@ -63,7 +63,7 @@ resource autoscaleSettings 'Microsoft.Insights/autoscalesettings@2022-10-01' = { scaleAction: { direction: 'Decrease' type: 'ChangeCount' - value: '1' + value: '2' cooldown: 'PT2M' } } From b904511d48e476e3a73a3db923989c5e3b2f4880 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 7 Dec 2023 21:38:00 +0000 Subject: [PATCH 03/14] Function Autoscale testing --- .../src/components/filepicker/file-picker.tsx | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/app/frontend/src/components/filepicker/file-picker.tsx b/app/frontend/src/components/filepicker/file-picker.tsx index e4387e982..cd0c15235 100644 --- a/app/frontend/src/components/filepicker/file-picker.tsx +++ b/app/frontend/src/components/filepicker/file-picker.tsx @@ -22,24 +22,9 @@ const FilePicker = ({folderPath, tags}: Props) => { const folderName = folderPath; const tagList = tags; - // // handler called when files are selected via the Dropzone component - // const handleOnChange = useCallback((files: any) => { - // let filesArray = Array.from(files); - - // filesArray = filesArray.map((file) => ({ - // id: nanoid(), - // file - // })); - - // setFiles(filesArray as any); - // setProgress(0); - // setUploadStarted(false); - // }, []); - // handler called when files are selected via the Dropzone component const handleOnChange = useCallback((files: any) => { if (files.length > 40) { - // Show an error message or handle this situation as you see fit alert("You can only upload up to 40 files at a time."); return; } From 7b763031616d9c3fcef93c61e402125eaccf5224 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 7 Dec 2023 21:47:01 +0000 Subject: [PATCH 04/14] Function Autoscale testing --- app/frontend/src/components/filepicker/file-picker.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/app/frontend/src/components/filepicker/file-picker.tsx b/app/frontend/src/components/filepicker/file-picker.tsx index cd0c15235..d04206579 100644 --- a/app/frontend/src/components/filepicker/file-picker.tsx +++ b/app/frontend/src/components/filepicker/file-picker.tsx @@ -34,7 +34,6 @@ const FilePicker = ({folderPath, tags}: Props) => { filesArray = filesArray.map((file) => ({ id: nanoid(), file - // rest of your code... })); setFiles(filesArray as any); setProgress(0); From e638504454b3c8df231141e9159d2ad13051aadb Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Fri, 8 Dec 2023 20:11:00 +0000 Subject: [PATCH 05/14] Adjust enrichment autoscale and remove ui cap --- .../src/components/filepicker/file-picker.tsx | 4 ---- .../core/host/enrichmentappserviceplan.bicep | 22 +++++++++++++++++-- infra/main.bicep | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/app/frontend/src/components/filepicker/file-picker.tsx b/app/frontend/src/components/filepicker/file-picker.tsx index d04206579..def593b3c 100644 --- a/app/frontend/src/components/filepicker/file-picker.tsx +++ b/app/frontend/src/components/filepicker/file-picker.tsx @@ -24,10 +24,6 @@ const FilePicker = ({folderPath, tags}: Props) => { // handler called when files are selected via the Dropzone component const handleOnChange = useCallback((files: any) => { - if (files.length > 40) { - alert("You can only upload up to 40 files at a time."); - return; - } let filesArray = Array.from(files); diff --git a/infra/core/host/enrichmentappserviceplan.bicep b/infra/core/host/enrichmentappserviceplan.bicep index fcf18b103..9d41e8a69 100644 --- a/infra/core/host/enrichmentappserviceplan.bicep +++ b/infra/core/host/enrichmentappserviceplan.bicep @@ -58,11 +58,29 @@ resource scaleOutRule 'Microsoft.Insights/autoscalesettings@2022-10-01' = { metricResourceUri: storageAccountId operator: 'GreaterThan' statistic: 'Average' - threshold: 10 + threshold: 5 + timeAggregation: 'Average' + timeGrain: 'PT1M' + timeWindow: 'PT10M' + } + } + { + scaleAction: { + direction: 'Decrease' + type: 'ChangeCount' + value: '1' + cooldown: 'PT5M' + } + metricTrigger: { + metricName: 'ApproximateMessageCount' + metricNamespace: '' + metricResourceUri: storageAccountId + operator: 'LessThan' + statistic: 'Average' + threshold: 2 timeAggregation: 'Average' timeGrain: 'PT1M' timeWindow: 'PT10M' - dividePerInstance: true } } ] diff --git a/infra/main.bicep b/infra/main.bicep index cd5721ce9..35f58e91d 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -177,7 +177,7 @@ module enrichmentAppServicePlan 'core/host/enrichmentappserviceplan.bicep' = { tier: 'PremiumV3' size: 'P1v3' family: 'Pv3' - capacity: 3 + capacity: 1 } kind: 'linux' reserved: true From ca6eaac80b948fdc5d753c1ffec5618d91696d27 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Mon, 11 Dec 2023 18:31:26 +0000 Subject: [PATCH 06/14] Change function host concurrency and enrichment scale metrics --- functions/host.json | 9 +++- .../core/host/enrichmentappserviceplan.bicep | 44 +++++++++---------- infra/main.bicep | 1 - 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/functions/host.json b/functions/host.json index 58badc323..4a5c6536f 100644 --- a/functions/host.json +++ b/functions/host.json @@ -12,9 +12,14 @@ "id": "Microsoft.Azure.Functions.ExtensionBundle", "version": "[3.*, 4.0.0)" }, + "extensions": { + "queues": { + "batchSize": 3 + } + }, "concurrency": { - "dynamicConcurrencyEnabled": true, - "snapshotPersistenceEnabled": true + "dynamicConcurrencyEnabled": false, + "snapshotPersistenceEnabled": false }, "functionTimeout": "01:00:00" } \ No newline at end of file diff --git a/infra/core/host/enrichmentappserviceplan.bicep b/infra/core/host/enrichmentappserviceplan.bicep index 9d41e8a69..c01ebe20c 100644 --- a/infra/core/host/enrichmentappserviceplan.bicep +++ b/infra/core/host/enrichmentappserviceplan.bicep @@ -6,8 +6,6 @@ param kind string = '' param reserved bool = true param sku object -param storageAccountId string - // Create an App Service Plan to group applications under the same payment plan and SKU, specifically for containers resource appServicePlan 'Microsoft.Web/serverfarms@2022-03-01' = { @@ -40,47 +38,45 @@ resource scaleOutRule 'Microsoft.Insights/autoscalesettings@2022-10-01' = { { name: 'Scale out condition' capacity: { - maximum: '3' + maximum: '5' default: '1' minimum: '1' } rules: [ { + metricTrigger: { + metricName: 'CpuPercentage' + metricResourceUri: appServicePlan.id + timeGrain: 'PT1M' + statistic: 'Average' + timeWindow: 'PT5M' + timeAggregation: 'Average' + operator: 'GreaterThan' + threshold: 60 + } scaleAction: { direction: 'Increase' type: 'ChangeCount' value: '1' cooldown: 'PT5M' } + } + { metricTrigger: { - metricName: 'ApproximateMessageCount' - metricNamespace: '' - metricResourceUri: storageAccountId - operator: 'GreaterThan' - statistic: 'Average' - threshold: 5 - timeAggregation: 'Average' + metricName: 'CpuPercentage' + metricResourceUri: appServicePlan.id timeGrain: 'PT1M' + statistic: 'Average' timeWindow: 'PT10M' + timeAggregation: 'Average' + operator: 'LessThan' + threshold: 20 } - } - { scaleAction: { direction: 'Decrease' type: 'ChangeCount' value: '1' - cooldown: 'PT5M' - } - metricTrigger: { - metricName: 'ApproximateMessageCount' - metricNamespace: '' - metricResourceUri: storageAccountId - operator: 'LessThan' - statistic: 'Average' - threshold: 2 - timeAggregation: 'Average' - timeGrain: 'PT1M' - timeWindow: 'PT10M' + cooldown: 'PT15M' } } ] diff --git a/infra/main.bicep b/infra/main.bicep index 35f58e91d..295a99777 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -181,7 +181,6 @@ module enrichmentAppServicePlan 'core/host/enrichmentappserviceplan.bicep' = { } kind: 'linux' reserved: true - storageAccountId: '/subscriptions/${subscriptionId}/resourceGroups/${rg.name}/providers/Microsoft.Storage/storageAccounts/${storage.outputs.name}/services/queue/queues/${embeddingsQueue}' } } From 2556b08eae8a181955f71ad4c69f43b3d2b6c8b0 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Tue, 12 Dec 2023 20:59:25 +0000 Subject: [PATCH 07/14] Add sku and autoscale markdown --- docs/deployment/autoscale_sku.md | 112 +++++++++++++++++++++++++++++++ docs/deployment/deployment.md | 2 + 2 files changed, 114 insertions(+) create mode 100644 docs/deployment/autoscale_sku.md diff --git a/docs/deployment/autoscale_sku.md b/docs/deployment/autoscale_sku.md new file mode 100644 index 000000000..4340b2303 --- /dev/null +++ b/docs/deployment/autoscale_sku.md @@ -0,0 +1,112 @@ +# Autoscale Settings Documentation + +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. + +## Azure Functions Service Plan Autoscale + +### Overview + +The Azure Functions Service Plan Autoscale settings are defined in the file located at `/infra/core/host/funcserviceplan.bicep`. These settings enable automatic scaling of the Azure Functions Service Plan based on CPU usage metrics. + + + + **File Location:** `/infra/core/host/funcserviceplan.bicep` + +#### Scaling Rules + +1. **Increase Capacity Rule:** + - **Metric:** `CpuPercentage` + - **Operator:** `GreaterThan` + - **Threshold:** `60%` + - **Time Window:** `5 minutes` + - **Scaling Action:** Increase capacity by `2` with a cooldown of `5 minutes`. + +2. **Decrease Capacity Rule:** + - **Metric:** `CpuPercentage` + - **Operator:** `LessThan` + - **Threshold:** `40%` + - **Time Window:** `5 minutes` + - **Scaling Action:** Decrease capacity by `2` with a cooldown of `2 minutes`. + +### Customization + +To customize the Azure Functions Service Plan Autoscale settings, modify the parameters mentioned above in the specified Bicep file. + +## App Service Plan Autoscale for Enrichment App + +### Overview + +The App Service Plan Autoscale settings for the enrichment app are defined in the file located at `/infra/core/host.enrichmentappserviceplan.bicep`. These settings enable automatic scaling of the App Service Plan based on CPU usage metrics. + +### Key Parameters + +**File Location:** `/infra/core/host.enrichmentappserviceplan.bicep` + +#### Scaling Rules + +1. **Increase Capacity Rule:** + - **Metric:** `CpuPercentage` + - **Operator:** `GreaterThan` + - **Threshold:** `60%` + - **Time Window:** `5 minutes` + - **Scaling Action:** Increase capacity by `1` with a cooldown of `5 minutes`. + +2. **Decrease Capacity Rule:** + - **Metric:** `CpuPercentage` + - **Operator:** `LessThan` + - **Threshold:** `20%` + - **Time Window:** `10 minutes` + - **Scaling Action:** Decrease capacity by `1` with a cooldown of `15 minutes`. + +### Customization + +To customize the App Service Plan Autoscale settings, modify the parameters mentioned above in the specified Bicep file. And Run the `make infrastructure` command. + + + +# SKU Settings Documentation + +### Overview + +The SKU settings for all Service Plans are defined in the file located at `/infra/main.bicep`. 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.](https://azure.microsoft.com/en-us/pricing/details/app-service/windows/#purchase-options) + +## Web App Service Plan SKU + + +**File Location:** `/infra/main.bicep` + +#### SKU Settings + +- **Name:** `S1` +- **Capacity:** `3` + + +## Functions Service Plan SKU + + +**File Location:** `/infra/main.bicep` + +#### SKU Settings + +- **Name:** `S2` +- **Capacity:** `2` + +## Enrichment App Service Plan SKU + + +**File Location:** `/infra/main.bicep` + +#### SKU Settings + +- **Name:** `P1v3` +- **Tier:** `PremiumV3` +- **Size:** `P1v3` +- **Family:** `Pv3` +- **Capacity:** `1` + +### Customization + +To customize the App Service Plans SKU settings, modify the `sku` parameters in the specified Bicep file and run the `make deploy` or `make infrastructure`command. + diff --git a/docs/deployment/deployment.md b/docs/deployment/deployment.md index 1860a7064..992eb18ab 100644 --- a/docs/deployment/deployment.md +++ b/docs/deployment/deployment.md @@ -126,6 +126,8 @@ extract-env-debug-functions Extract local.settings.json to debug functions from functional-tests Run functional tests to check the processing pipeline is working ``` +Information about out of the box Autoscale and App Service SKU's can be found [here](/docs/deployment/autoscale_sku.md) + ## Configure authentication and authorization If you have chosen to enable authentication and authorization for your deployment by setting the environment variable `REQUIRE_WEBSITE_SECURITY_MEMBERSHIP` to `true`, you will need to configure it at this point. Please see [Known Issues](/docs/knownissues.md#error-your-adminstrator-has-configured-the-application-infoasst_web_access_xxxxx-to-block-users) section for guidance on how to configure. From bd9e0f3289ecbb7a56eb75ef356d7ccf45b66106 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Wed, 13 Dec 2023 18:11:57 +0000 Subject: [PATCH 08/14] Update docs and resolve enrichment concurrency issue --- app/enrichment/app.py | 19 ++++++++++++-- docs/deployment/autoscale_sku.md | 44 +++++++++++++++++++++++++++++--- infra/main.bicep | 2 +- 3 files changed, 59 insertions(+), 6 deletions(-) diff --git a/app/enrichment/app.py b/app/enrichment/app.py index d4f9ed297..271384838 100644 --- a/app/enrichment/app.py +++ b/app/enrichment/app.py @@ -4,6 +4,8 @@ import json import logging import os +import threading +import time import re from datetime import datetime from typing import List @@ -276,9 +278,17 @@ def get_tags_and_upload_to_cosmos(blob_service_client, blob_path): tagsHelper.upsert_document(blob_path, tags_list) return tags_list - @app.on_event("startup") -@repeat_every(seconds=5, logger=log, raise_exceptions=True) +def startup_event(): + poll_thread = threading.Thread(target=poll_queue_thread) + poll_thread.daemon = True + poll_thread.start() + +def poll_queue_thread(): + while True: + poll_queue() + time.sleep(5) + def poll_queue() -> None: """Polls the queue for messages and embeds them""" @@ -294,6 +304,11 @@ def poll_queue() -> None: response = queue_client.receive_messages(max_messages=int(ENV["DEQUEUE_MESSAGE_BATCH_SIZE"])) messages = [x for x in response] + if not messages: + log.debug("No messages to process. Waiting for a couple of minutes...") + time.sleep(120) # Sleep for 2 minutes + return + target_embeddings_model = re.sub(r'[^a-zA-Z0-9_\-.]', '_', ENV["TARGET_EMBEDDINGS_MODEL"]) # Remove from queue to prevent duplicate processing from any additional instances diff --git a/docs/deployment/autoscale_sku.md b/docs/deployment/autoscale_sku.md index 4340b2303..3c1657f12 100644 --- a/docs/deployment/autoscale_sku.md +++ b/docs/deployment/autoscale_sku.md @@ -29,9 +29,6 @@ The Azure Functions Service Plan Autoscale settings are defined in the file loca - **Time Window:** `5 minutes` - **Scaling Action:** Decrease capacity by `2` with a cooldown of `2 minutes`. -### Customization - -To customize the Azure Functions Service Plan Autoscale settings, modify the parameters mentioned above in the specified Bicep file. ## App Service Plan Autoscale for Enrichment App @@ -106,7 +103,48 @@ More information can be found [here.](https://azure.microsoft.com/en-us/pricing/ - **Family:** `Pv3` - **Capacity:** `1` +### Enrichment Message Dequeue Parameter +There exist a property that can be set int he local.env file called `DEQUEUE_MESSAGE_BATCH_SIZE` and is defaulted in the `infra/main.bicep` 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 opitmal with the existing configuration but can be increased if you also increase tne 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. + ### Customization To customize the App Service Plans SKU settings, modify the `sku` parameters in the specified Bicep 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 occurrs. + + +### Steps to Scale Up: + +>1. **Sign in to the Azure Portal:** +> - Open a web browser and navigate to the [Azure Portal](https://portal.azure.com/). +> - Log in with your Azure account credentials. + +>2. **Navigate to the App Service:** +> - In the left navigation pane, select "App Services." +> - Click on the specific App Service you want to scale. + +>3. **Access the Scale Up Blade:** +> - In the App Service menu, find and click on "Scale up (App Service plan)" in the left sidebar. + +>4. **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. + +>5. **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. + + +### Considerations: +- **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. + +By following these steps, you can successfully scale up your Azure App Service to accommodate increased workloads or resource requirements. diff --git a/infra/main.bicep b/infra/main.bicep index 295a99777..c077e1d45 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -205,7 +205,7 @@ module enrichmentApp 'core/host/enrichmentappservice.bicep' = { AZURE_BLOB_STORAGE_KEY: storage.outputs.key EMBEDDINGS_QUEUE: embeddingsQueue LOG_LEVEL: 'DEBUG' - DEQUEUE_MESSAGE_BATCH_SIZE: 1 + DEQUEUE_MESSAGE_BATCH_SIZE: 3 AZURE_BLOB_STORAGE_ACCOUNT: storage.outputs.name AZURE_BLOB_STORAGE_CONTAINER: containerName AZURE_BLOB_STORAGE_UPLOAD_CONTAINER: uploadContainerName From bacd8e1297f7606d44455529cfb40fe949a64232 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Wed, 13 Dec 2023 18:27:12 +0000 Subject: [PATCH 09/14] Update docs and resolve enrichment concurrency issue --- docs/deployment/autoscale_sku.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/deployment/autoscale_sku.md b/docs/deployment/autoscale_sku.md index 3c1657f12..6fd5a7459 100644 --- a/docs/deployment/autoscale_sku.md +++ b/docs/deployment/autoscale_sku.md @@ -104,7 +104,7 @@ More information can be found [here.](https://azure.microsoft.com/en-us/pricing/ - **Capacity:** `1` ### Enrichment Message Dequeue Parameter -There exist a property that can be set int he local.env file called `DEQUEUE_MESSAGE_BATCH_SIZE` and is defaulted in the `infra/main.bicep` 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 opitmal with the existing configuration but can be increased if you also increase tne 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. +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.bicep` 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 opitmal with the existing configuration but can be increased if you also increase tne 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. ### Customization @@ -147,4 +147,3 @@ This can also be adjusted in the Azure Portal. - **Performance Impact:** - Scaling up provides additional resources, potentially improving performance. However, it's essential to assess whether your application benefits from the increased resources. -By following these steps, you can successfully scale up your Azure App Service to accommodate increased workloads or resource requirements. From 589c779f0d40d0c7039f5f9d4d5fbd6f4301beae Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 14 Dec 2023 16:11:08 +0000 Subject: [PATCH 10/14] Update docs --- docs/deployment/deployment.md | 2 -- docs/features/optional_features.md | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/deployment/deployment.md b/docs/deployment/deployment.md index 992eb18ab..1860a7064 100644 --- a/docs/deployment/deployment.md +++ b/docs/deployment/deployment.md @@ -126,8 +126,6 @@ extract-env-debug-functions Extract local.settings.json to debug functions from functional-tests Run functional tests to check the processing pipeline is working ``` -Information about out of the box Autoscale and App Service SKU's can be found [here](/docs/deployment/autoscale_sku.md) - ## Configure authentication and authorization If you have chosen to enable authentication and authorization for your deployment by setting the environment variable `REQUIRE_WEBSITE_SECURITY_MEMBERSHIP` to `true`, you will need to configure it at this point. Please see [Known Issues](/docs/knownissues.md#error-your-adminstrator-has-configured-the-application-infoasst_web_access_xxxxx-to-block-users) section for guidance on how to configure. diff --git a/docs/features/optional_features.md b/docs/features/optional_features.md index b0634a3b1..3efa0d001 100644 --- a/docs/features/optional_features.md +++ b/docs/features/optional_features.md @@ -10,6 +10,7 @@ Please see below sections for coverage of IA Accelerator optional features. * [Customer Usage Attribution](/docs/features/features.md#customer-usage-attribution) * [Sovereign Region Deployment](/docs/features/features.md#sovereign-region-deployment) * [Configure REST API access](#configure-rest-api-access) +* [Customize Autoscale and App Service SKU's](#customize-autoscale) ## Configuring your own language ENV file @@ -45,3 +46,8 @@ Check out how to [setup Sovereign Region Deployment](/docs/deployment/enable_sov If you are wanting to use the API stand-alone or use a custom UI. Check out how to [enable OAuth Client Credentials Flow](/docs/deployment/client_credentials_flow.md) + +## Customize Autoscale + +If you want to learn more about Autoscale Settings and App SErvice SKU's +Check out how to [customize Autoscale settings](/docs/deployment/autoscale_sku.md) From 49d129f1f749939236a51e8610a306c9cdcdaf05 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 14 Dec 2023 16:12:46 +0000 Subject: [PATCH 11/14] Update docs --- docs/features/optional_features.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/features/optional_features.md b/docs/features/optional_features.md index 3efa0d001..21fc6c50f 100644 --- a/docs/features/optional_features.md +++ b/docs/features/optional_features.md @@ -49,5 +49,5 @@ Check out how to [enable OAuth Client Credentials Flow](/docs/deployment/client_ ## Customize Autoscale -If you want to learn more about Autoscale Settings and App SErvice SKU's +If you want to learn more about Autoscale Settings and App Service SKU's Check out how to [customize Autoscale settings](/docs/deployment/autoscale_sku.md) From e1b5468388535343a8bdad1b7395aa5e8cb73e84 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Thu, 14 Dec 2023 16:16:06 +0000 Subject: [PATCH 12/14] Update docs --- docs/deployment/autoscale_sku.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/deployment/autoscale_sku.md b/docs/deployment/autoscale_sku.md index 6fd5a7459..688d42133 100644 --- a/docs/deployment/autoscale_sku.md +++ b/docs/deployment/autoscale_sku.md @@ -104,7 +104,7 @@ More information can be found [here.](https://azure.microsoft.com/en-us/pricing/ - **Capacity:** `1` ### Enrichment Message Dequeue Parameter -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.bicep` 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 opitmal with the existing configuration but can be increased if you also increase tne 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. +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.bicep` 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 opitmal 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. ### Customization From a9739a58cfe527381f3504b9f995ecce0970058b Mon Sep 17 00:00:00 2001 From: dayland Date: Fri, 15 Dec 2023 09:57:46 +0000 Subject: [PATCH 13/14] whitespace change to trigger new build --- scripts/inf-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/inf-create.sh b/scripts/inf-create.sh index 4793b102d..a75a83266 100755 --- a/scripts/inf-create.sh +++ b/scripts/inf-create.sh @@ -215,4 +215,4 @@ results=$(az deployment sub create --location $LOCATION --template-file main.bic #save deployment output printInfo "Writing output to infra_output.json" pushd "$DIR/.." -echo $results > infra_output.json +echo $results > infra_output.json \ No newline at end of file From 59adee8c5a19125159de19587befccb8e3f76818 Mon Sep 17 00:00:00 2001 From: ryonsteele Date: Fri, 15 Dec 2023 20:01:57 +0000 Subject: [PATCH 14/14] Test increased timeout --- functions/host.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/host.json b/functions/host.json index 4a5c6536f..b13fe7eea 100644 --- a/functions/host.json +++ b/functions/host.json @@ -21,5 +21,5 @@ "dynamicConcurrencyEnabled": false, "snapshotPersistenceEnabled": false }, - "functionTimeout": "01:00:00" + "functionTimeout": "02:00:00" } \ No newline at end of file