Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding package.json warning when using AzureFiles #501

Merged
merged 2 commits into from
Dec 17, 2021

Conversation

alrod
Copy link
Member

@alrod alrod commented Dec 16, 2021

On reading function code NodeJs tries to find 'package.json' all the way up to the file system root
In Azure files it causes a delay during cold start as connection to Azure Files is an expensive operation.

We want to add a log to detect the issue.

delayInMs = 5000;
}
setTimeout(() => {
const path = require('path');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I would put this "path" import at the top of the file with all the other imports

this.log({
message:
'package.json is not found at the root of the Function App in Azure Files - cold start for NodeJs can be affected.',
level: LogLevel.Debug,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be LogLevel.Warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it as LogLevel. Debug as we do not want to scary customers with sudden unknown warning.

@@ -167,6 +168,8 @@ export class WorkerChannel implements IWorkerChannel {
err = exception;
}

this.logColdStartWarning();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe by putting this in functionLoadRequest, the log will get written once per function. However, we really only need to log it once per app. With that in mind, I think workerInitRequest might be a better place

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you are right. moved to workerInitRequest

@alrod alrod requested a review from ejizba December 17, 2021 00:15
@alrod alrod merged commit f263edb into v3.x Dec 17, 2021
@alrod alrod deleted the alrod/coldstart-warning branch December 17, 2021 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants