Skip to content

perf(serve): seed web timeline from SQLite; non-blocking startup (0.1.1)#31

Merged
mishanefedov merged 1 commit into
mainfrom
perf-serve-startup-seed
May 25, 2026
Merged

perf(serve): seed web timeline from SQLite; non-blocking startup (0.1.1)#31
mishanefedov merged 1 commit into
mainfrom
perf-serve-startup-seed

Conversation

@mishanefedov
Copy link
Copy Markdown
Owner

Summary

  • The web dashboard took ~12s to open on large installs: serve started with an empty in-memory ring and waited on every adapter's synchronous file backfill, blocking the event loop ~10s.
  • serve now seeds the ring from store.listRecentEvents() on startup (the TUI already did this) — data is available immediately.
  • Adapters start on the next tick so the server answers requests before the backfill runs.
  • Per-file backfill window 4MB → 512KB (history comes from the store now, backfill only covers the gap since last run).
  • /api/events limit clamped 50000 → 2000 to avoid multi-hundred-MB responses.
  • Bumps version to 0.1.1 + CHANGELOG.

Test plan

  • npm run typecheck clean
  • npm test — 404 passed
  • npm run build OK
  • Smoke test on ~1GB real history: server responsive 10.8s → 0.46s; first /api/events?limit=100 12.1s → 1.4s

The web dashboard took ~12s to open on large installs because `serve`
started with an empty ring and waited on every adapter's synchronous file
backfill, blocking the event loop ~10s.

- serve now seeds the ring from store.listRecentEvents() on startup (the TUI
  already did this), so /api/events has data immediately (~0.5s responsive).
- adapters start on the next tick so the server answers requests first.
- per-file backfill window 4MB -> 512KB (history comes from the store now).
- /api/events limit clamped 50000 -> 2000 to avoid huge payloads.

Measured on a ~1GB history: first /api/events 12.1s -> 1.4s.
@mishanefedov mishanefedov merged commit 4b6cd6d into main May 25, 2026
3 checks passed
@mishanefedov mishanefedov deleted the perf-serve-startup-seed branch May 25, 2026 22:58
mishanefedov added a commit that referenced this pull request May 25, 2026
perf(serve): seed web timeline from SQLite; non-blocking startup (0.1.1)
mishanefedov added a commit that referenced this pull request May 25, 2026
perf(serve): seed web timeline from SQLite; non-blocking startup (0.1.1)
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