garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/tile-queuing.md

raw


topic: streaming triggers: [workers.rs, "workers::submit", submit_ranked, submit_heavy_ranked, Urgency, urgency_for_ring, AGING_JOBS, fetch_gate, Dispatcher, reprice, wanted_shared, tile_rank_at, "tiles queue", "tile stall", "unseen tiles keep loading", wait_us] updated: 2026-10-05

Where a tile waits, and who decides the order

A tile passes four queues on the way to the screen. Only the last one used to be unordered, and it was the one that hid the others' work.

  1. CellStream's Dispatcher (platform/work.rs): per-stream, ranked, capped by max_in_flight (map tiles: 8). Lowest rank first, arrival order among equals.
  2. fetch_gate (platform/fetch_gate.rs): one global cap across every streamer, with a reserve of 4 that only rank <= NEAR (1) may spend. Rank is Chebyshev ring distance from the camera's cell.
  3. The IO task pool: fetch and storage read. Not ordered, and not the bottleneck.
  4. platform::workers: the CPU stage (decode, scan conversion, mip chain, meshing). A FIFO pool that cannot be reordered from outside.

The finding (2026-09-28, from reading, not from a capture). Priority was honoured at 1 and 2 and thrown away at 4. A tile under the camera and a tile the camera had left were the same to the pool: whichever job was submitted first started first. Eight map-tile jobs cannot flood it alone; the contention is the other streamers sharing it.

What replaced it

workers keeps waiting jobs in its own queue and hands the pool no more than its width, so the order is decided in pick, not by arrival. Urgency is BASEMAP 0, NEAR 1, NORMAL 2 (the default of plain submit), FAR 3. urgency_for_ring maps a ring distance onto them.

Who states an urgency: map tiles BASEMAP; surfaces and lod22 by ring; terrain_field and terrain_fine NEAR (ground and building cells wait on the field); routing NEAR (a person tapped for it and is watching a spinner); globe, tall_structures, transit and data_layers FAR (decoration nobody is waiting on). Everything else is NORMAL. The ranks are reasoned, not measured — look at the wait column for a label before moving it.

What the wait column said on a warm start over Groningen at 3 km (2026-10-05, this container, dev build, 7 worker threads, worker_split in --dump-state; busy and wait are summed over jobs, in seconds): lod22 9 jobs, 25.5 busy, 27.4 wait; surfaces 9, 23.0, 11.2; bag_facts 25, 12.5, 0.0; osm_buildings 76, 10.0, 1.2; map_tiles 145, 7.5, 2.9; globe 166, 3.8, 7.7. The building cells wait longest because each is seconds of work in the heavy lane.

Two more rules in map_stream

Not done