Reducing Cold Start Duration in Azure Functions

Back in February, I published the first version of Cold Starts in Azure Functions—the detailed analysis of cold start durations in serverless Azure. The article showed the following numbers for C# and JavaScript functions:

Typical cold start durations per language (February 2019)

Note that I amended the format of the original chart: the range shows the most common 67% of values, and the dot shows the median value. This change makes the visual comparison easier for the rest of today’s post.

My numbers triggered several discussions on twitter. In one of them, Jeff Hollan (a program manager on Functions team) responded:

The team collects the stats of cold starts internally, and their numbers were lower than mine. We started an e-mail thread to reconcile the results. I won’t publish any messages from the private thread, but I’m posting the main findings below.

Check the deployment method

For my tests, I’ve been using “Run from external package” deployment method, where the function deployment artifact is stored as a zip file on blob storage. This method is the most friendly for automation and infrastructure-as-code pipelines.

Apparently, it also increases the cold start duration. I believe the situation already improved since my original article, but here are the current numbers from mid-March.

.NET:

Cold start durations per deployment method for C# functions (March 2019)

Node.js:

Cold start durations per deployment method for JavaScript functions (March 2019)

Run-from-external-zip deployment increases the cold start by approximately 1 second.

Application Insights

I always configured my Function Apps to write telemetry to Application Insights. However, this adds a second to the cold start:

Cold start durations with and without Application Insights integration

I can’t really recommend “Don’t use Application Insights” because the telemetry service is vital in most scenarios. Anyway, keep this fact in mind and watch the corresponding issue.

Keep bugging the team

While you can use the information above, the effect is still going to be limited. Obviously, the power to reduce the cold starts lies within the Azure Functions engineering team.

Coincidence or not, the numbers have already significantly improved since early February, and more work is in progress.

I consider this to be a part of my mission: spotlighting the issues in public gives that nudge to prioritize performance improvements over other backlog items.

Meanwhile, the data in Cold Starts in Azure Functions and Comparison of Cold Starts in Serverless Functions across AWS, Azure, and GCP are updated: I’m keeping them up-to-date as promised before.

P.S.


Cloud developer and researcher.
Software engineer at Pulumi. Microsoft Azure MVP.

Responses
Visit the Github Issue to comment on this page