Skip to content

refactor: lazy-load azurefunctions.extensions.base for Python 3.13+#1878

Open
gavin-aguiar wants to merge 1 commit into
devfrom
gaaguiar/coldstart
Open

refactor: lazy-load azurefunctions.extensions.base for Python 3.13+#1878
gavin-aguiar wants to merge 1 commit into
devfrom
gaaguiar/coldstart

Conversation

@gavin-aguiar

Copy link
Copy Markdown
Collaborator

Description

Defers the import of azurefunctions.extensions.base on the v2 runtime cold path so apps that don't use deferred bindings or HTTP v2 don't pay the cost. This recovers roughly 170–200 ms of cold-start time on Python 3.13+ Flex Consumption.

Validation

  • Cold-start profile on Flex Consumption mesh container (Python 3.13, real production image) measured with PYTHONPROFILEIMPORTTIME=1:
Profile Total cumulative imports Notes
Before 608 ms 6 azurefunctions.extensions.base.* modules in report (~260 ms cumulative)
After 355 ms Zero azurefunctions.extensions.base.* modules

Fixes #


Pull Request Checklist

Host-Worker Contract

  • Does this PR impact the host-worker contract (e.g., gRPC messages, shared interfaces)?
    • If yes, have the changes been applied to:
      • azure_functions_worker (Python <= 3.12)
      • proxy_worker (Python >= 3.13)
    • If no, please explain why:

Worker Execution Logic

  • Does this PR affect worker execution logic (e.g., function invocation, bindings, lifecycle)?
    If yes, please answer the following:

Python Version Coverage

  • Does this change apply to both Python <=3.12 and 3.13+?
  • If yes, have the changes been made to:
    • azure_functions_worker (Python <= 3.12)
    • runtimes/v1 / runtimes/v2 (Python >= 3.13)
  • If no, please explain why:

Programming Model Compatibility (for Python 3.13+)

  • Does this change apply to both:
    • V1 programming model (runtimes/v1)?
    • V2 programming model (runtimes/v2)?
  • Explanation (if limited to one model):

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.

1 participant