Skip to content

Performance

Speed is a product feature of Glacez. The platform is not optimised afterwards: its read paths, its data model and its caches are shaped for execution time, and a change is judged on the cost it keeps or adds.

Read this page when you change a read path, add or broaden a query, add a call between services, or are about to "simplify" a data structure that a hot path relies on.

The cost of a read

A read costs what it asks for × how many times it repeats that per element, reduced by what the store can skip through an index and by what the process already holds. That is the whole model; the expensive shapes are variations of three:

  • Asking for more than the view needs. Two sets expanded into their product (every instrument × every timestamp) when the pairs would do, a collection fetched whole to be filtered, counted or sorted in Java, a request repeated per row instead of a bulk call. The size a path can reach is a number, and it has to be bounded by what the caller renders or returns.
  • Repeating the same work per element of a series. A running total, a carried-forward position or a currency rate is computed once, in one pass over the ordered data, and read back by lookup. Recomputing it for each of N points is the same work N times, and it grows with the user's history.
  • Work in the process that belongs to the store. Filtering, counting, sorting and joining are the query's job, and the index must match the access order; a loop over everything just fetched undoes both.

Mechanisms the platform relies on

Mechanism What it buys Where it lives
Incremental replay Positions for every point of a series from a single forward pass; each instant applies only its own transactions to the state carried in PositionsFactory
Sorted maps with carried state A value "as of" an instant in log time (floor/ceiling) instead of a scan: series snapshots, cross rates snapshot factories, CrossRateService
Bounded request shapes A call between services asking for the ids it needs, a series capped to its display size, bulk endpoints instead of per-item calls price requests, getAdaptiveTimestamps, findata contracts
Indexes matching the access order The store answering by key set without a collection scan; the price store is indexed both ways round plus a partial index for the live row Ohlcv compound and partial indexes
Per-process caches with TTLs Prices, currencies and keys read on nearly every request without re-asking a slow or rate-limited source ADR-005
A tuned HTTP boundary Connection pool sized for the fan-out, a retry strategy that is chosen rather than defaulted, and venue pacing with a warm-up HttpClientConfig, venue rate limiters
Deliberate parallelism A map is split across threads only past the size where it pays; below it the coordination costs more than the loop PARALLEL_THRESHOLD

None of these is a micro-optimisation: each removes an order of magnitude, and each can be undone by a well-meaning simplification that looks cleaner in the diff.

What decides a change

Before a read-path change is approved: the size it can reach is named and bounded, the series work is one pass, the query uses the index that exists for it, the hot path goes through the cache it should, and the number behind the change is quoted (request size, rows read, or duration from the log line or metric) for before and after. The rule and the pre-commit gate live in Glacez/AGENTS.md § Performance; how a Glacez Java change is reviewed, and the idioms a refactor must preserve, in the glacez-clean-code skill.

What the platform can observe today

  • HTTP metrics per service (Micrometer through the chart's ServiceMonitor): counts, averages and maxima per endpoint and status. Percentile histograms are switched off, so a p95 from these metrics does not exist yet; it is a chart/config change, not a data gap.
  • Gateway latency in Kong: request and upstream latency histogram buckets per route, which do give a p95 (query shapes in the glacez-grafana-ops skill).
  • The services' own log lines: the price store logs the size of each request it answers, and the snapshot services log per-step timings, which is how a request-shape regression is spotted before it is felt.

Not in place yet, and therefore not a control: a per-endpoint latency budget, a query-cost guard in CI, and alerting on a degradation rather than on a failure. Until those exist the design review is the gate, and this page is the reference it is held against.

Related: