3 Performance Principles
Nate edited this page 2026-11-21 20:21:39 -08:00

Performance Principles

EveSynapse is built to stay lightweight, lean, fast, and efficient at scale, without compromising features, power, or security. Three rules govern how data moves:

  1. Precompute at ingest, never at render. Expensive work (medians, bands, aggregates, rankings) happens once in the background worker when data arrives, and its results are stored. Page handlers never recompute what a scheduled job already computed.
  2. Bounded reads on every render. A page handler may only read a bounded number of rows per render (on the order of ~100). No full-table scans, no unbounded sorts or filters in Go, no per-row queries in loops. Filtering, sorting, and ranking belong in SQL with a LIMIT; anything the page needs beyond that belongs in a stored table written at ingest time.
  3. Resident in-memory snapshots and rings. High-traffic shared surfaces (the search index, market stat pack and pricing stack, recent public kill feed, SDE universe topology, entity directory, system threat heatmap, and fleet overview rollups) are held in RAM, updated on ingest and served on render with zero database roundtrips. For resource-constrained hosts, LOW_RAM_MODE=1 in .env disables memory caching and routes all reads through SQL.

Data changes on a known schedule (market sweeps complete every 30 minutes; character snapshots refresh on their own cadence), so a page that re-derives everything per load is doing repeat work for an identical answer. Under one user that is a CPU spike; under a hundred it is an outage. When in doubt, push the work into the worker and store the result.