0
0
Azurecloud~10 mins

Function scaling behavior in Azure - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the trigger type for an Azure Function.

Azure
public static void Run([[1]Trigger] string myQueueItem, ILogger log) {
    log.LogInformation($"Processing: {myQueueItem}");
}
Drag options to blanks, or click blank then click option'
AHttp
BBlob
CTimer
DQueue
Attempts:
3 left
💡 Hint
Common Mistakes
Using HttpTrigger when the function is triggered by a queue message.
Using BlobTrigger which is for blob storage events.
2fill in blank
medium

Complete the code to set the maximum number of function instances in host.json.

Azure
{
  "version": "2.0",
  "functionTimeout": "00:05:00",
  "concurrency": {
    "dynamicConcurrencyEnabled": true,
    "[1]": 5
  }
}
Drag options to blanks, or click blank then click option'
AmaxFunctionInstances
BmaxDegreeOfParallelism
CmaxInstances
DmaxConcurrentRequests
Attempts:
3 left
💡 Hint
Common Mistakes
Using maxDegreeOfParallelism which controls threads, not instances.
Using maxConcurrentRequests which is unrelated to scaling instances.
3fill in blank
hard

Fix the error in the Azure Function scale controller setting.

Azure
{
  "version": "2.0",
  "extensions": {
    "queues": {
      "batchSize": 16,
      "maxDequeueCount": [1]
    }
  }
}
Drag options to blanks, or click blank then click option'
A5
B"5"
C-1
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string value instead of an integer.
Setting maxDequeueCount to zero or negative numbers.
4fill in blank
hard

Fill both blanks to configure the function app to scale based on CPU and memory thresholds.

Azure
{
  "scaling": {
    "rules": [
      {
        "metricTrigger": {
          "metricName": "[1]",
          "threshold": 70
        },
        "scaleAction": {
          "direction": "Increase",
          "type": "ChangeCount",
          "value": "1"
        }
      },
      {
        "metricTrigger": {
          "metricName": "[2]",
          "threshold": 80
        },
        "scaleAction": {
          "direction": "Increase",
          "type": "ChangeCount",
          "value": "1"
        }
      }
    ]
  }
}
Drag options to blanks, or click blank then click option'
ACpuPercentage
BMemoryPercentage
CDiskQueueLength
DHttpQueueLength
Attempts:
3 left
💡 Hint
Common Mistakes
Using disk or HTTP queue metrics which are unrelated to CPU/memory scaling.
Mixing up the metric names.
5fill in blank
hard

Fill all three blanks to define a scale rule that decreases instances when the queue length is low.

Azure
{
  "rules": [
    {
      "metricTrigger": {
        "metricName": "[1]",
        "threshold": [2],
        "timeAggregation": "Average"
      },
      "scaleAction": {
        "direction": "[3]",
        "type": "ChangeCount",
        "value": "1",
        "cooldown": "PT5M"
      }
    }
  ]
}
Drag options to blanks, or click blank then click option'
AQueueLength
B10
CDecrease
DIncrease
Attempts:
3 left
💡 Hint
Common Mistakes
Using Increase instead of Decrease for scaling down.
Using a threshold that is too high or unrelated metric names.