Azure / Azure/azure-functions-powershell-worker

Invoke profile.ps1 on function load request

Open
#453 0 comments 0 reactions 1 assignee Claimed by @AnatoliB View on GitHub
cold start
Dominant language
C#
Stars
215
Forks
61
Avg merge
21h 4m
Merged PRs (30d)
6

Description

Currently, `profile.ps1` is executed on the first function _invocation_ request on a given PowerShell worker instance. When executing `profile.ps1` takes long time (for example, because of the first `Connect-AzAccount` call), this is perceived as a cold start issue affecting even apps on Premium and App Service plans.

If we invoke `profile.ps1` on the function _load_ request instead (immediately after installing managed dependencies, if required), this invocation will be performed on worker instance warmup on Premium and App Service plans. If the instance is given enough time to warm up, the first function _invocation_ will not even hit `profile.ps1`, so it will not be affected by this delay.

This is a potentially breaking change, as executing `profile.ps1` too early (and even without any function invocation) may surprise users. However, these situations are supposedly rare, and the vast majority will benefit from this change.

Apps on Consumption will not be affected by this change, because we cannot execute `profile.ps1` before the worker instance is assigned to a specific app.

See also: #454

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.