Skip to main content

Contract Delta: YU11-aeron-replication

1. Existing external contracts​

REST /orders, REST /orders/batch, FIX 4.4 ingress, risk decisions, order lifecycle output, trade booking, UI routing, and every inherited NATS subject retain their YU10 contracts. Aeron is cluster-internal BLP replication only.

2. Order-matcher configuration​

VariableValues / defaultContract
BLP_REPLICATION_TRANSPORTnats / aeron; default natsSelects the authoritative replication data/ACK leg. Both peers must match.
BLP_REPLICATION_AERON_SHADOWboolean; default falseWith NATS authoritative, runs Aeron record/consume/checksum comparison without BLP injection or gating.
BLP_REPLICATION_ACK_MODEonring / durable; default onringDurable uses the exact follower journal force watermark.
BLP_REPLICATION_FAILURE_POLICYdegraded-solo / strict; default degraded-soloStrict requires durable ACK and closes admission on peer durability loss.
BLP_FAILOVER_MODElease / fast-witness; default leaseSelects synchronous Kubernetes Lease or direct-heartbeat + NATS-KV witness promotion.
BLP_CLUSTER_IDnon-empty stringReplication/witness identity; mismatch rejects handshake.
BLP_REPLICATION_SECRET_FILEfile pathShared HMAC secret mounted from a Kubernetes Secret.
BLP_AERON_DIRpathShared application/sidecar Aeron directory.
BLP_AERON_DATA_CHANNELAeron URIPrimary-to-follower reliable unicast channel.
BLP_AERON_ACK_CHANNELAeron URIFollower-to-primary ACK channel.
BLP_AERON_CONTROL_CHANNELAeron URIHandshake, heartbeat, replay, snapshot-control channel.
BLP_AERON_STREAM_IDintegerInput-event stream ID.
BLP_AERON_ACK_STREAM_IDintegerDurable-ACK stream ID.
BLP_AERON_CONTROL_STREAM_IDintegerControl stream ID.
BLP_AERON_OFFER_TIMEOUT_MSpositive integerBounded offer/backpressure timeout before policy transition.
BLP_AERON_HEARTBEAT_INTERVAL_MSpositive integer; default 10Direct heartbeat cadence.
BLP_AERON_PEER_STALE_MSpositive integer; default 40Fast-mode peer staleness threshold; must exceed heartbeat interval.
BLP_FAST_WITNESS_BUCKETdefault TRADERX_BLP_FAST_WITNESSNATS KV bucket used for atomic fast promotion.
BLP_FAST_WITNESS_TERM_MSpositive integerWitness claim term.
BLP_ARCHIVE_DIRpathSidecar recording/catalog path on the persistent volume.
BLP_ARCHIVE_MIN_FREE_BYTESpositive integerFail-closed disk watermark.

Unknown enum values and incompatible flag combinations fail startup before readiness.

3. Internal Aeron channels​

ChannelTransportDirectionPayload
datareliable unicast UDPcurrent primary -> followerSBE InputEventMessage
ACKreliable unicast UDPfollower -> current primarySBE DurableAckMessage
controlreliable unicast UDPbidirectionalhello/challenge, heartbeat, replay and snapshot control
Archive replayreliable unicast UDPrecording sidecar -> follower applicationrecorded SBE input/snapshot stream

Channels resolve peers through StatefulSet ordinal DNS. NetworkPolicy permits these UDP ports only between pods labeled app=order-matcher in the runtime namespace.

4. Admission and HTTP outcomes​

  • Default degraded-solo: peer loss changes health/metrics and transport state but the primary continues journal-protected admission. A request that already entered the ring retains the inherited acknowledgement semantics.
  • Strict: replication gap/timeout closes the synchronous admission fence; new REST requests receive 503. A request already sequenced with an ambiguous response retains 504 semantics and idempotent retry rules.
  • Fast-witness: admission opens only after a successful witness compare-and-set and closes before any order when witness revision/epoch/Lease proof becomes foreign or ambiguous.
  • A follower, replaying pod, mismatched peer, or gap-bearing pod never accepts orders.

5. Health contract​

The order-matcher health payload adds:

{
"replication": {
"transport": "nats|aeron",
"shadow": false,
"ackMode": "onring|durable",
"failurePolicy": "degraded-solo|strict",
"state": "AERON_LIVE",
"leaderEpoch": 7,
"offeredSeq": 1000,
"followerReceivedSeq": 1000,
"followerJournaledSeq": 1000,
"followerAppliedSeq": 1000,
"acknowledgedSeq": 1000,
"shadowComparedSeq": 1000,
"archiveLagBytes": 0,
"archiveFreeBytes": 10737418240,
"schemaChecksum": "sha256:..."
},
"failover": {
"mode": "lease|fast-witness",
"peerHeartbeatAgeMillis": 8,
"witnessRevision": 31,
"witnessHolder": "order-matcher-0",
"leaseReconciled": true
}
}

Readiness is false for schema/epoch mismatch, replay gap, Archive fault, strict replication loss, or an unproven promotion. Degraded-solo primary readiness remains true and reports the degraded state.

6. Metrics contract​

  • traderx_blp_replication_offered_total{transport}
  • traderx_blp_replication_consumed_total{transport}
  • traderx_blp_replication_backpressure_total{transport,result}
  • traderx_blp_replication_ack_latency_seconds{mode}
  • traderx_blp_replication_watermark{kind}
  • traderx_blp_replication_shadow_mismatch_total{reason}
  • traderx_blp_aeron_retransmits_total
  • traderx_blp_aeron_loss_gap_total
  • traderx_blp_archive_lag_bytes
  • traderx_blp_archive_free_bytes
  • traderx_blp_fast_witness_claim_total{result}
  • traderx_blp_fast_failover_seconds{phase}

7. Operational storage contract​

The Archive uses the order-matcher PVC. Capacity expansion is an operator procedure:

  1. verify the StorageClass has allowVolumeExpansion=true;
  2. patch each existing order-matcher PVC request to 10Gi;
  3. wait for filesystem resize completion;
  4. recreate the StatefulSet object with --cascade=orphan so its immutable volumeClaimTemplates records 10Gi without deleting pods/PVCs;
  5. verify both retained claims, Archive free-byte metrics, and journal/snapshot paths before selecting Aeron.