Skip to content

[finding] AppPlugin's inline boot seed costs 3 sequential round trips per seed record, on every boot that reaches it #10979

Description

@os-zhuang

Measured while establishing the seed-replay cost for objectstack-ai/cloud#1560 (fix: objectstack-ai/cloud#1561). The cloud side is closed; this is the framework half of the same cost, and it comes with an open question I could not settle from outside the container.

The measurement

Rig: scripts/dev-local/bootstrap-curve.mjs in the cloud repo — the real ArtifactKernelFactory.create() over the real TursoDriver in mode: 'remote', with an instrumented @libsql/client counting every round trip and attributing it to a build step.

Synthetic artifact: 10 objects, N seed records spread across them, each record carrying one cel time value so the loader's isNoOpReplay skip cannot fire (--seed-dynamic). Every point is a rebuild — tables present, rows already seeded.

seed records0100200400800
bootstrap step round trips23955285214522652

3.02 round trips per seed record, inside bootstrap. Same 3 legs the seed loader's update path always pays — a pre-read, the UPDATE, and a read-back — and they are sequential: charging a synthetic per-call RTT scales the step proportionally.

The source is AppPlugin's inline boot seed (packages/runtime/src/app-plugin.ts, the else branch after the multiTenant check), running SeedLoaderService.load() over normalizedDatasets at plugin start, on every boot.

Why this is a finding and not a bug report

The inline seed is already gated:

constmultiTenant=this.organizationWallActive(ctx);if(this.skipSeedData){}elseif(multiTenant){seedSource.suppress('multi-tenant-replay');// "per-org replay will run on sys_organization insert"}else{/* inline seed — the 3 legs/record path */}

In the rig's kernel the gate reads false and the inline seed runs. I could not establish whether it also reads false in the production container — that needs a reading from a live tenant kernel, and cloud#1560's ruling forbids touching the reproduction environment. So the honest statement is:

  • The cost is real and measured on a kernel built by the production factory with the production capability slate.
  • Whether production reaches this branch is unverified. If it does, every hosted environment pays ~3 sequential legs per seed record inside bootstrap on top of what cloud#1561 just removed from seed-replay — and bootstrap is the step objectstack-ai/cloud#1555 measured at 134 s against a 20 s request waiter.

What would close it

Two separable questions, and the first is cheap:

  1. Does a hosted tenant kernel take this branch? One log line, or one assertion in an existing multi-tenant harness, settles it. If it does not, this reduces to a single-tenant os dev cost and can be closed as such.
  2. If it does — the same shape as objectstack-ai/cloud#1561: a boot that re-applies a seed union it has already applied has nothing to gain from the round trips, and the fix is to know that rather than to make each leg cheaper. Batching the update path would also help every genuine first seed, which the ledger approach does not.

Related, same family: #10946 (4 sequential round trips per permission set / position at boot), #10945 (registry rescan, quadratic in stored metadata).

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions