Note: This question is part of a series of questions that present the same scenario.
Each question in the series contains a unique solution that might meet the stated goals.
Some question sets might have more than one correct solution, while others might not have a correct solution.
After you answer a question in this section, you will NOT be able to return to it.
As a result, these questions will not appear in the review screen.
You develop an HTTP triggered Azure Function app to process Azure Storage blob data.
The app is triggered using an output binding on the blob.
The app continues to time out after four minutes.
The app must process the blob data.
You need to ensure the app does not time out and processes the blob data.
Solution: Configure the app to use an App Service hosting plan and enable the Always On setting.
Does the solution meet the goal?
Click on the arrows to vote for the correct answer
A. B.B.
Instead pass the HTTP trigger payload into an Azure Service Bus queue to be processed by a queue trigger function and return an immediate HTTP success response.
Note: Large, long-running functions can cause unexpected timeout issues.
General best practices include: Whenever possible, refactor large functions into smaller function sets that work together and return responses fast.
For example, a webhook or HTTP trigger function might require an acknowledgment response within a certain time limit; it's common for webhooks to require an immediate response.
You can pass the HTTP trigger payload into a queue to be processed by a queue trigger function.
This approach lets you defer the actual work and return an immediate response.
https://docs.microsoft.com/en-us/azure/azure-functions/functions-best-practicesThe proposed solution to configure the app to use an App Service hosting plan and enable the Always On setting does not necessarily meet the goal of preventing the app from timing out and processing the blob data.
Enabling the Always On setting on an App Service hosting plan ensures that the web application does not go to sleep, which could be beneficial in certain scenarios. However, it does not necessarily resolve the issue of an HTTP-triggered Azure Function app timing out while processing blob data.
In addition, using an App Service hosting plan for an HTTP-triggered Azure Function app is not the optimal approach. An Azure Function app is a serverless architecture, and it is designed to be run on the Consumption plan by default. The Consumption plan automatically scales out to multiple instances to handle incoming requests and provides cost-efficient pricing based on the number of executions and execution time.
To resolve the timeout issue in an HTTP-triggered Azure Function app, you can try one or more of the following:
Increase the function timeout setting: The default function timeout setting for an HTTP-triggered function app is 5 minutes. You can increase this setting by modifying the functionTimeout
property in the host.json
file.
Optimize your code: Review your code to ensure it is optimized for performance. Avoid using blocking operations and optimize long-running tasks.
Use asynchronous programming: Asynchronous programming can help reduce the execution time of a function. Use the async/await pattern or the Task Parallel Library (TPL) to execute long-running tasks asynchronously.
Use Azure Durable Functions: Azure Durable Functions can help you manage long-running workflows and stateful operations. By using Azure Durable Functions, you can split a long-running operation into smaller, more manageable chunks and avoid timing out.
In summary, while enabling the Always On setting on an App Service hosting plan may prevent the app from going to sleep, it does not necessarily resolve the timeout issue in an HTTP-triggered Azure Function app processing blob data. It is important to consider other solutions, such as increasing the function timeout, optimizing code, using asynchronous programming, or using Azure Durable Functions, to resolve the issue.