Clicks on the map were hanging for 1-3s, triggering the Phoenix topbar progress bar visible to the user. Three hot-path improvements: 1. ScoresFile.read_point now uses a two-range :file.pread/2 — reads the 33-byte header + one cell byte (~60 bytes) instead of the full ~93 KB file. point_forecast walks 19 forecast hours per click, so the old full-read path was the dominant cost on cold cache. 2. ProfilesFile.read/1 and list_valid_times/0 cached via Microwaveprop.Cache (5s TTL). Decoded profile maps are ~10 MB each (92k cells); timeline scrub that re-clicks the same valid_time within seconds now hits ETS instead of re-gunzipping + decoding. Cache keys include base_dir so test setup that swaps dirs doesn't see stale entries. Writes + prune + retain_window invalidate. 3. Endpoint log_level now filters /metrics the same way it already filters /health — Prometheus scrapes every 5s and was producing visible log spam. Pod-local ETS is right for this workload (per-click read, tiny working set); Valkey / shared memstore would not help here since each pod needs its own fast-path lookup. File a follow-up if cross-pod score lookups ever show up in flame graphs. |
||
|---|---|---|
| .. | ||
| components | ||
| controllers | ||
| live | ||
| plugs | ||
| endpoint.ex | ||
| gettext.ex | ||
| live_table_footer.ex | ||
| metrics_plug.ex | ||
| router.ex | ||
| skew_t.ex | ||
| telemetry.ex | ||
| user_auth.ex | ||