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

Cold Start Optimization #10776

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open

Cold Start Optimization #10776

wants to merge 1 commit into from

Conversation

RohitRanjanMS
Copy link
Member

When the Host gets initialized in placeholder mode, all needed assemblies get JIT compiled during placeholder mode so we will not pay the cost for JIT during Specialization. We want to exercise as much of the code path as we can during placeholder mode to avoid JIT during specialization.

resolves #10453

Pull request checklist

IMPORTANT: Currently, changes must be backported to the in-proc branch to be included in Core Tools and non-Flex deployments.

  • Backporting to the in-proc branch is not required
    • Otherwise: Link to backporting PR
  • My changes do not require documentation changes
    • Otherwise: Documentation issue linked to PR
  • My changes should not be added to the release notes for the next release
    • Otherwise: I've added my notes to release_notes.md
  • My changes do not need to be backported to a previous version
    • Otherwise: Backport tracked by issue/PR #issue_or_pr
  • My changes do not require diagnostic events changes
    • Otherwise: I have added/updated all related diagnostic events and their documentation (Documentation issue linked to PR)
  • I have added all required tests (Unit tests, E2E tests)
    ditional PR information

@RohitRanjanMS RohitRanjanMS requested a review from a team as a code owner January 29, 2025 09:15
@RohitRanjanMS RohitRanjanMS requested a review from jviau January 29, 2025 09:15

foreach (string substring in ExcludedRequestSubstrings)
{
if (uri.IndexOf(substring, StringComparison.Ordinal) >= 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this will need to be made more robust:

  1. This looks like it might not be cheap to perform on a hotpath like this
  2. These substrings may have a chance of false-positives.

Possible solutions:

  1. Is there something besides URI on the HttpRequestMessage we can use to identify these calls?
  2. Can we add something to the HttpRequestMessage to identify these calls? Such as adding a value to .Options to indicate this call is to be filtered out.
  3. Can we use an AsyncLocal to suppress Http client telemetry collection?

return loggingBuilder
// These are messages piped back to the host from the worker - we don't handle these anymore if the worker has OpenTelemetry enabled.
// Instead, we expect the user's own code to be logging these where they want them to go.
.AddFilter<OpenTelemetryLoggerProvider>("Function.*", _ => !ScriptHost.WorkerOpenTelemetryEnabled)
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious why we explicitly care about WorkerOptenTelemetryEnabled? What if worker is using app-insights. Don't ask why an app would use OTel in host and AppInsights in the worker, but what if they did?

What I am getting at is, should there be a general flag of worker is managing its own telemetry, and agnostic to exactly how it is doing so?

@@ -7,6 +7,7 @@ internal enum TelemetryMode
{
None = 0, // or Default
ApplicationInsights = 1,
OpenTelemetry = 2
OpenTelemetry = 2,
Placeholder = 3
Copy link
Contributor

Choose a reason for hiding this comment

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

small nit: I would put placeholder as 1. Just feels right...

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.

Cold Start Optimization
2 participants