You'd use async
in Azure Functions for the same reasons you would in any other application. For operations that block on potentially long running external I/O, it'll be a much more efficient use of resources. Azure Functions fully supports async in the runtime core, so when used correctly, it will allow for more parallelism and better throughput on a single Function App since threads aren't blocked waiting for I/O and can be used to process more requests/triggers.
If your Function App is running on a Classic SKU, then you're paying for an Always On instance, so it's clear you want to use resources as efficiently as possible.
When running in the Dynamic SKU, I think your question was that if we'll just scale out your functions as needed, then who cares if they're using resources efficiently? I'd still say that it is best for you to code your functions so they run as efficiently as possible. That way we're only scaling you out when truly needed, and minimizing any cold start times for new instances as we spin them up.
async
functionality. – Boormanawait
in the "top-level" function, or are there other benefits? – Gunsmith