Skip to content

TrailView phone tier: smaller caches and fewer workers #3778

Closed

Description

@timohueser

Status: approved

Part of #3656. Depends on #3777.

TL;DR

Goal: On the phone tier, the workers and the main page keep less decoded data after a load: about 300 MiB less, with no visible change. The phone's byte caps add up to a sum that a unit test holds.
Systems: trailview
Size: M (1 system, about ten modules)

Plan

  1. Each worker gets its byte cap in its first message: stream/ground-worker.ts (its BUDGET, from stream/ground.ts), terrain/stamp-worker.ts (its tileBudget, from terrain/stamps.ts) and structures/house-worker.ts (from structures/houses.ts; today it calls no tileBudget and keeps the default 32 MiB). HEAP_LIMIT of plan/plan.ts comes from the budget; plan/plan.ts and terrain/model.ts check it. The count of plan workers comes from the budget in terrain/model.ts (WORKERS) and in src/trailview.ts, which gives it to preload of plan/bridge.ts.
  2. The main page's caches read the budget: terrain/stamps.ts (NODE_BYTES 64 → 24 MiB), plan/plan.ts (KEPT_BYTES 32 → 16), terrain/pages.ts (BODIES 64 → 16: the plan's records and cells read their tiles from it, so it cannot be 0), stream/terrain.ts (FEATURE_BODIES 32 → 8), stream/ground.ts (BODIES 16 → 2 per archive, for each of the six archives).
  3. vegetation/tree-models.ts: a worker ends after 10 s with no job, and a new job starts one again. Both tiers.
  4. budget.ts gets PHONE_CAPS, 188 MiB: the sum of the phone's byte caps that the epic's budget assumes (ground decode 2 × 16, stamp 24, house 16, plan heap 40, stamped nodes 24, plan records 16, terrain bodies 16, feature bodies 8, ground bodies 6 × 2). budget.test.ts (new) fails when the phone's caps add up to more. The caps are not hard limits (a cache keeps the tiles that a view wants past its cap), so the test guards against an edit that raises a cap; the phone runs measure the memory. A pull request that raises a cap raises PHONE_CAPS and says why.
  5. On the phone at tier=phone: the kind runs (p-end-* of the kit), and one full turn at the walk with the time until the view is complete (the ground pool holds 64 of the 102 pages that the walk wants, so a turn loads pages again). Each kind gives back at most its phone value in the epic's budget plus one probe step (32 MiB). Then the soak (p-soak): it ends with at least 512 MiB of headroom. If it does not, report it on the epic: the next lever of the epic's budget becomes a sub-issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions