Skip to content

Time Start module evaluation separately from first-request app init - #1677

Merged
RhysSullivan merged 1 commit into
mainfrom
diag/split-module-vs-init
Aug 18, 2026
Merged

Time Start module evaluation separately from first-request app init#1677
RhysSullivan merged 1 commit into
mainfrom
diag/split-module-vs-init

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

The cold/warm probe showed warm isolates answering in 9-104ms and cold ones in 2.5-4.9s, with wasWarm false on essentially every request. But one warm sample took 5247ms and n=4 warm is too small to conclude from.

More importantly, "first Start request in this isolate" bundles two different costs:

  1. evaluating the 2.56MB module graph (loadEntries)
  2. building the app's Effect layers — DB, WorkOS — for the first time

Those want different fixes (warm/split/slim the graph vs. fix layer construction), and nothing so far distinguishes them. Importing the same virtual ids loadEntries uses means its cache finds the module already evaluated, so moduleMs captures the graph load and handlerMs captures everything else.

Diagnostic only.

A cold isolate pays both: evaluating the 2.56MB module graph and building
the app's Effect layers for the first time. Those have different fixes.
Import the same virtual ids loadEntries uses so its cache finds the module
already evaluated, leaving handlerMs to cover only the rest.
@RhysSullivan
RhysSullivan merged commit 9551da9 into main Aug 18, 2026
@RhysSullivan
RhysSullivan deleted the diag/split-module-vs-init branch August 18, 2026 23:19
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

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