Skip to main content

Performance and sizing

Structures is a memory-speed engine, and the honest way to reason about its performance is the same as for FluxDB: start from the cost of one operation, then multiply by the workload and the placement. This page gives the cost model the engine actually has, the per-type cost shape, the instrumentation it exposes so you can measure your own workload rather than trust a brochure number, and a sizing guide.

How to read the numbers on this page

Where the engine's own performance harness records a concrete figure, this page quotes it and says so. Those figures are an algorithmic reference measured on a single development machine, not a throughput guarantee for your hardware. Where the code gives a cost shape rather than a number, this page describes the shape. The instrumentation section exists so you can measure the figure that actually matters, which is the one from your own deployment.

Where the time goes in one command​

A structure command passes through two distinct layers, and they have very different costs.

LayerWhat it doesReference cost
The storeThe raw keyspace: look up a key, read or write its value, update accountingFastest layer. The engine's harness records roughly 1,860,000 GET/sec (about 0.54 microseconds each) and 454,000 SET/sec (about 2.20 microseconds each) against the bare store
The command processorArity check, command-to-handler resolution, authorization, metering, metrics, slow-log accounting, then the handlerThe same harness records roughly 182,000 GET/sec (about 5.49 microseconds each) and 118,000 SET/sec (about 8.49 microseconds each) through the full processor

The gap between the two rows is the per-command engine overhead: client bookkeeping, registry lookup, arity validation, the authorizer, and metrics. It is the overhead the engine is built to keep bounded, not the cost of the data operation itself.

Per-connection registration is why the wire is faster than it looks​

One piece of that overhead is client registration. On the RESP wire a client registers once per connection, not once per command, so the register and unregister churn that the per-command figures above include is paid a single time when the connection opens, not on every call. A long-lived connection running a pipeline pays the data cost per command and the registration cost once.

Per-type cost shape​

"Redis-class" does not mean every type is O(1). The cost shape follows the data structure behind each type, and a few are worth stating plainly because they are where a workload gets surprised.

Type familyCost shape
Strings, hashes, lists, setsPoint operations are constant-time dictionary work. Bulk operations (HGETALL, SMEMBERS, LRANGE over a long list) are linear in what they return
Sorted setsMembership and score lookup are constant-time against a member-to-score map. Ranked and range reads (ZRANGE, ZRANK, ZPOPMIN and relatives) materialize a sorted view, so they pay an O(N log N) sort over the set. This is the cost to size for on large sorted sets read by rank
VectorsBelow a measured crossover of 1,024 members a similarity search (VSIM) is an exact brute-force scan, O(N) in the member count. At or above the crossover the set builds an HNSW graph index and search runs at roughly O(log N). Defaults: graph degree M = 16, build breadth ef_construction = 200, search breadth ef_search = 64. The index is a rebuildable cache, not persisted, so it is rebuilt on load rather than shipped
TensorsEach verb is a thin wrapper over a NumPy n-dimensional array, so an operation costs what the equivalent NumPy call costs. Dense byte size is known from shape and dtype without materializing, so an oversized allocation is refused in constant time rather than attempted. Sparse (COO and 2-D CSR) layouts are available for sparse data
Dataframe structuresA columnar frame. Append and point reads are cheap; FRAME.GROUPBY, FRAME.JOIN, FRAME.ORDERBY and FRAME.SQL cost what the scan, join and sort they express cost, and FRAME.SQL runs through the plan optimizer below
StreamsAppend (XADD) is amortized constant-time onto the entry log; range reads scan the requested window. Consumer-group bookkeeping (XINFO) is O(groups), not a per-entry scan, because the pending-entries list is tracked per group
Probabilistic sketchesBloom, Cuckoo, Count-Min, t-digest, HyperLogLog, HyperMinHash, Top-K and DDSketch trade exactness for a bounded, sublinear footprint. Add and query are near constant-time, and the memory is the sketch size you reserve, not the cardinality it summarizes

The practical reading: point and append operations across the type surface are cheap, and the operations to budget for are the ones that sort, scan or join, with sorted-set rank reads and sub-crossover vector search the two most common surprises.

What the engine exposes​

You do not have to infer performance from the outside. The engine carries its own instrumentation, and it is the same data an operator surface and the metering ledger read.

The slow log​

The engine keeps a slow log on the Redis model. A command whose execution exceeds a threshold is recorded with its duration, a truncated argument summary, the client id and a timestamp.

PropertyDefaultChanged with
Threshold10,000 microseconds (10 ms)CONFIG SET slowlog-log-slower-than
Ring length128 entriesCONFIG SET slowlog-max-len

SLOWLOG GET, SLOWLOG LEN and SLOWLOG RESET read and clear it, exactly as a Redis client expects.

Per-command and per-namespace metrics​

Every executed command folds into two metric views that are updated in lockstep, so they can never disagree about whether a call happened:

  • An engine-wide, per-command view: call count, total duration, error count, last-call time, and a latency histogram.
  • An additive per-(namespace, command) view, so you can ask "how slow is this command in this workspace's database", not only "how slow is it engine-wide".

Latency is kept as a fixed log2-scale histogram (32 buckets spanning microseconds to roughly 2,147 seconds) rather than a stored sample stream, so p50, p95 and p99 are derivable for any command without per-call storage.

Per-type health rollup​

Above the per-command view, the engine rolls metrics and state up per structure type, so a cell, node or org can read the health of each type. A rollup carries, per type: live instance count, bytes, ops, error count and error rate, p50, p95 and p99 latency, convergence lag for replicated types, and a capacity pressure zone (cruise, peak, warn, overload) against a utilization model rather than a flat ceiling. The instance and byte counts come from a bounded sweep, so a health call stays cheap on a large keyspace and honestly reports partial when the sweep is clipped rather than paying an unbounded scan.

Metering​

Command consumption is metered at the one choke point every surface passes through. The hot path folds each command into an in-process accumulator (constant time, no I/O per command), and a periodic flush emits one usage sample per namespace, so the ledger sees a bounded number of rows per interval regardless of command volume. Replicated applies from peer cells are deliberately not metered, because a peer-shipped write is platform convergence rather than customer work.

The plan optimizer​

The QUERY command and FRAME.SQL do not execute a statement as written. They are planned by a SQL planner, rewritten by a cost-based plan optimizer, and run by a plan executor over the frame data source. The optimizer applies five rewrites:

RewriteWhat it does
Predicate pushdownMoves a filter below a join so rows are discarded before they are joined
Projection pushdownPushes column selection below a join so each side carries only the columns the result needs
Constant foldingDrops a tautological filter (1=1) and short-circuits a contradictory one (1=0) to an empty result
Join strategy selectionChooses merge join when both inputs are already sorted, nested-loop join when one input is small (estimated under 1,000 rows), and hash join otherwise
Limit pushdownPushes a LIMIT into the branches of a union so each branch returns only what is needed

Join strategy and the small-input decision read cardinality and selectivity estimates, so the plan reflects the shape of the data rather than the order the statement was written in.

Spill performance, RAM to disk to object storage​

A cache keeps what fits in RAM and drops the rest. Structures instead spills cold keys down a tier ladder, which is the property that lets a structure outgrow memory. The tiers and their restore cost:

TierWhereAccess cost
HotIn processMemory speed, already resident
WarmLocal durable storageRestored transparently on access, a local read
ColdObject storagePromoted back to warm on a hit, an object-store read

Victim selection is least-frequently-used, then least-recently-used, so what leaves memory is what the workload stopped touching, and the restore cost on a later hit is the cost of the tier it fell to, not a miss. The mechanism is codec-agnostic: entries move through the engine's own snapshot codec and the tier backends move bytes, so no type needs a bespoke spill path.

The performance consequence worth sizing for: a hot working set served from RAM keeps memory-speed latency while the long tail lives on cheaper tiers, and a read that reaches into a cold key pays a tier-appropriate fetch on the first touch and memory speed afterward. You size RAM to the working set, not to the whole dataset.

How to size a deployment​

The sizing method mirrors FluxDB's: reason from the operation up, not from a headline number down.

Start from the data model​

Pick the type that matches the shape of the data, then read its cost shape from the table above. A counter, a queue, a membership set and a point lookup are constant-time and cheap to run hot. A sorted set read by rank, a sub-crossover vector search, and a dataframe join or sort are the operations whose cost grows with the data, and they are what a capacity estimate should be built around.

Budget memory to the working set, then spill​

The first budget is memory for the hot working set, because that is what sets the latency floor. Spill extends capacity past that budget rather than forcing it: cold keys move to warm and cold tiers, so a single structure can exceed a cell's RAM, and with placement across cells a single logical structure can exceed the pooled RAM of the whole cluster. Size RAM to the data you touch and the tiers to the data you keep.

Scale across cells, and set replica policy per type​

Capacity scales with how many cells hold the keyspace, because slots place across cells by the platform's own topology with a single-cell fast path that pays nothing when there is one cell. Replica policy is declared per structure type, so a probabilistic sketch that can be rebuilt declares zero replicas and spends no high availability where it is not worth spending, while a latency-sensitive vector or geospatial type declares same-zone affinity to keep placement close. See Persistence and distribution for the placement and replica model in full.

Measure, do not guess​

Then measure. The slow log, the per-command and per-namespace metrics, and the per-type health rollup are there so the figure you plan against is your workload's, not a reference machine's. As with FluxDB, the constraint that shows up in a real deployment is rarely single-command latency, which the engine already keeps low; it is throughput and footprint as the data grows and spreads, and that is answered by the working-set budget, the spill tiers, cell count and replica policy rather than by a faster command.

Across the deployment matrix​

  • Single cell. The store, the command processor, the slow log and metrics, and the warm spill tier run locally. The distribution fast path costs nothing.
  • Multi-cell. Metrics and health roll up per type across cells; cold spill reaches shared object storage; replica policy applies per type across failure domains.
  • Sovereign and air-gapped. Every tier is local to the estate. No external cache or coordinator is required for the engine to spill or to report its own health.
  • Edge. The Edge Agent carries the matching runtime and the same command contract; its slice is sized to the device rather than the cell.