Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Build
Start
Reference code
Tools
API reference
Public services
Agents
Bindings and crosswalks

Performance bench (WP-RI-11)

REFERENCE Source reference/rust/README.md

FieldValue
StatusIndicative measurements on one shared machine; not a capacity claim; no conformance claim
Versionsobsp-core 0.0.2, obsp-gateway 0.0.1
SourceRust reference workspace

Indicative measurements on one shared build machine, as the README records them; not a capacity claim and not a conformance claim.

Design target not met: The same, 8 clients. Measured 18 400 to 25 800 against a target of at least 100 000 observations per second per node (missed by a factor of 4 to 5).

cargo run --release -p obsp-gateway --example bench -- --root ../.. [--n 40000] measures signature verification per object, the intake’s per-event checks, and ingest throughput. Measured on the build container, indicative only: a shared 4-thread virtual machine (Intel Xeon at 2.1 GHz) with other jobs running (load average 4.5 to 4.9 before each run, so the 4 threads were never free), release build, two runs (the range is shown), 40 000 records of about 1.4 kB as the node agent writes them (live 3.1.0 shape, Ed25519 envelope), batches of 64 events. Clients and gateway share the same four threads. Nothing here is a capacity or conformance claim.

Measure Before (previous gateway, same bench and session, one run) Now Design target (master plan)
Ed25519 verify, whole envelope (JCS payload, SHA-256, CBOR header, key resolution, signature) 0.051 ms 0.041 ms per object at most 0.1 ms met
Ed25519 verify, signature only 0.040 ms 0.035 to 0.038 ms
ML-DSA-65 verify, whole envelope 0.173 ms 0.161 to 0.164 ms per object at most 0.5 ms met
Intake checks per observation, no HTTP (digest, two schema validations, Ed25519 envelope), 1 thread 0.072 ms 0.058 to 0.059 ms, about 17 000 per second
The same on 4 threads not available 0.026 to 0.031 ms, 32 000 to 39 000 per second
End-to-end ingest over loopback HTTP, keep-alive, in-memory store, 1 client 4 300 events per second 11 100 to 11 300
The same, 4 clients 4 600 17 400 to 18 100
The same, 8 clients 4 100 18 400 to 25 800 at least 100 000 observations per second per node missed by a factor of 4 to 5
File store, 4 clients, synced on every write 4 300 10 900 to 15 700
File store, synced once every 64 writes (--fsync-every 64), 4 and 8 clients not available 13 500 to 19 200
Node agent as the client (a connection per batch, its outbox synced after each answer) 3 200 6 800 to 7 100

What changed, with every check kept (each event still gets its digest check, its schema validations and a strict Ed25519 verification, and the dispositions are those of checking the events one at a time, in order):

  • Key records are indexed by node in the store (Store::node_keys), in the order the old scan produced; a batch no longer scans every stored event, so its cost no longer grows with the store.
  • The store lock is held only for the decision, not for the checks. A batch’s events are checked before the lock, in parallel on the hardware threads (shared between the batches in flight) with results kept in input order, each against the key records it would see if the batch were processed at that moment (the stored ones, then the batch’s own earlier key records). Under the lock the dispositions are decided in order; a precomputed result is used only when the event saw exactly those key records, otherwise the event is checked again there (obsp-gateway/tests/ingest.rs compares the answers with a one-thread gateway, concurrent batches included).
  • Less repeated work: each payload is canonicalized once (its digest, and its text inside the batch’s own canonical form for the idempotency digest); the signed bytes are canonicalized without copying the object; object keys are ordered without a buffer per key and plain strings are copied whole; a schema check of a valid document uses the validator’s boolean path (errors are only collected for an invalid one); decoded Ed25519 public keys are cached per thread; accepted payloads are moved into the store instead of copied. Schemas were already compiled once.
  • Group commit is an option: --fsync-every <n> syncs the store file once every n writes (default 1, every write). Above 1, up to n - 1 answered writes can be lost on power loss; every line is still written before its answer.
  • The bench now posts prepared requests from 1, 4 and 8 clients that each keep one HTTP/1.1 connection alive (the gateway always allowed keep-alive; the node agent’s own client opens one connection per batch).

Not done, and why. Batch signature verification (the Ed25519 batch equation) was not used: it accepts some signatures that the strict single verification the intake uses refuses (it is a cofactored, randomized check), so it would weaken the check, and a batch failure would still need the single checks to say which event failed. The store remains one in-memory map behind one lock: with the checks moved out, the time under the lock is a small share of a batch, so sharding it would not change these numbers.

Why the target is still missed: on this machine the work per observation does not fit. One strict Ed25519 verification costs about 0.035 ms, so 100 000 per second needs about 3.5 fully free cores for the signatures alone; the whole intake check costs about 0.058 ms (about 5.8 cores at the target), and parsing the JSON body (about 0.01 ms per event), the batch’s idempotency digest and the HTTP clients come on top. The bench’s four threads are shared with the clients and with other jobs (load average about 4.5 before each run), and the 4-thread no-HTTP figure (32 000 to 39 000 per second) is the ceiling the end-to-end numbers approach. Reaching the target needs more cores than this machine has (roughly 8 to 16 free cores at this per-event cost, by the arithmetic above, not measured), or a cheaper event (for example one signature over a batch instead of one per observation, which is a protocol change, not a gateway change).