Mirexa

Wiki Design

Bibliography

Papers, specifications and other systems' documentation that inform Mirexa's design, each with a full citation and a line on how it relates to the code.

These are the external works that Mirexa's design draws on or deliberately departs from. Each entry gives a full citation, a stable link (a DOI where one exists), and one line on where the connection shows up in Mirexa. Only works whose connection can be stated from the code, its comments or this wiki are included; Mirexa does not claim to implement any of them in full unless the entry says so.

Consensus and cluster coordination

Raft

Diego Ongaro and John Ousterhout. "In Search of an Understandable Consensus Algorithm." Proceedings of the 2014 USENIX Annual Technical Conference (USENIX ATC '14), pp. 305–319. https://www.usenix.org/conference/atc14/technical-sessions/presentation/ongaro

Relation. The control plane — node registry, partition directory, cluster settings, migrations, revoked keys — is a Raft-replicated state machine. Candle and tick data never enter the log (decision).

Raft dissertation

Diego Ongaro. Consensus: Bridging Theory and Practice. PhD dissertation, Stanford University, 2014. https://web.stanford.edu/~ouster/cgi-bin/papers/OngaroPhD.pdf

Relation. Non-voting members that catch up before they vote, one-at-a-time membership changes and leadership transfer are all used: a joining node is admitted as a non-voter and promoted by the leader, and a decommissioned leader transfers leadership before it is removed (decision).

hashicorp/raft

HashiCorp. raft: Golang implementation of the Raft consensus protocol, v1.8.0. https://github.com/hashicorp/raft · API documentation: https://pkg.go.dev/github.com/hashicorp/[email protected]

Relation. The consensus library, imported only by internal/raft. Its behaviours shape several decisions: no read index (a linearizable read is a Barrier plus a local read), no in-place voter demotion, and FSM.Apply cannot fail (decision).

raft-boltdb

HashiCorp. raft-boltdb: Raft backend implementation using BoltDB, v2. https://github.com/hashicorp/raft-boltdb

Relation. The Raft log and stable store, under <data_dir>/raft/. A custom log store over Mirexa's own WAL was refused.

Raft autopilot

HashiCorp. raft-autopilot: Raft cluster health and server promotion. https://github.com/hashicorp/raft-autopilot

Relation. The model for the leader promoting caught-up non-voters toward an odd voter count on the same Raft library, rather than nodes promoting themselves (cited in internal/control/promotion.go).

Kafka replication

Apache Software Foundation. Apache Kafka Documentation — Design: Replication. https://kafka.apache.org/documentation/#replication

Relation. Several mechanisms follow Kafka's: pull replication where the follower holds its cursor ("follower fetch"), an in-sync replica set that writes wait on, partitions moved by a directory rather than by rehashing, and an out-of-range position answered as such (OFFSET_OUT_OF_RANGE is cited in the WAL tail code) (decision).

KIP-500

Colin McCabe et al. KIP-500: Replace ZooKeeper with a Self-Managed Metadata Quorum. Apache Kafka Improvement Proposal, 2019. https://cwiki.apache.org/confluence/display/KAFKA/KIP-500%3A+Replace+ZooKeeper+with+a+Self-Managed+Metadata+Quorum

Relation. A small Raft quorum holds cluster metadata while data is replicated outside it, and the quorum stays 3 or 5 voters however many nodes the cluster has — Mirexa's split.

KIP-631

Colin McCabe. KIP-631: The Quorum-based Kafka Controller. Apache Kafka Improvement Proposal, 2020. https://cwiki.apache.org/confluence/display/KAFKA/KIP-631%3A+The+Quorum-based+Kafka+Controller

Relation. Brokers heartbeat the active controller and only registration and fencing reach the metadata log; Mirexa's liveness tracking is leader-local and in memory for the same reason (decision, cited in internal/cluster/liveness.go).

Cassandra seeds

Apache Software Foundation. Apache Cassandra Documentation — Configuring Cassandra (seed provider). https://cassandra.apache.org/doc/latest/cassandra/getting-started/configuring.html

Relation. cluster.seeds are contact points for first contact, not leader addresses, as Cassandra's seeds are (decision).

Leases and fencing

Leases

Cary G. Gray and David R. Cheriton. "Leases: An Efficient Fault-Tolerant Mechanism for Distributed File Cache Consistency." Proceedings of the 12th ACM Symposium on Operating Systems Principles (SOSP '89), pp. 202–210, 1989. https://doi.org/10.1145/74850.74870

Relation. A primary serves only under a time-bounded lease granted by acknowledged heartbeats, sized so it ends before the earliest fence; failover waits out any lease the dead primary could hold (decision).

Chubby

Mike Burrows. "The Chubby Lock Service for Loosely-Coupled Distributed Systems." Proceedings of the 7th USENIX Symposium on Operating Systems Design and Implementation (OSDI '06), pp. 335–350, 2006. https://www.usenix.org/legacy/event/osdi06/tech/full_papers/burrows/burrows.pdf

Relation. Chubby's lock sequencers — a number a server checks so that a holder whose lock lapsed cannot act — are the idea behind the partition epoch that every write carries and the primary checks.

Fencing tokens

Martin Kleppmann. "How to do distributed locking." Blog post, 8 February 2016. https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-locking.html

Relation. A fencing token must be monotonic and checked by the resource. Mirexa's epoch is the Raft log index of the entry that installed a primary, so it cannot be reused across a leader change (decision).

DDIA

Martin Kleppmann. Designing Data-Intensive Applications. O'Reilly Media, 2017. ISBN 978-1-4493-7332-0.

Relation. General background for the trade-offs recorded here: leader-based asynchronous replication and the writes it can lose on failover (chapter 5), partitioning by hash with a fixed number of partitions (chapter 6), and fencing and leases (chapter 8).

Dynamo

Giuseppe DeCandia et al. "Dynamo: Amazon's Highly Available Key-value Store." Proceedings of the 21st ACM Symposium on Operating Systems Principles (SOSP '07), pp. 205–220, 2007. https://doi.org/10.1145/1294261.1294281

Relation. The consistent-hashing alternative Mirexa refused: the partition count never changes, so hash mod count is stable and movability comes from the partition directory (decision).

Storage, encoding and integrity

Gorilla

Tuomas Pelkonen, Scott Franklin, Justin Teller, Paul Cavallaro, Qi Huang, Justin Meza and Kaushik Veeraraghavan. "Gorilla: A Fast, Scalable, In-Memory Time Series Database." Proceedings of the VLDB Endowment 8(12), pp. 1816–1827, 2015. https://doi.org/10.14778/2824032.2824078

Relation. Gorilla's XOR float encoding is an optional column codec (compression.algorithm: gorilla), and its delta-of-delta timestamp scheme is the basis of the default fixed_point_dod codec, which applies delta-of-deltas to fixed-point integers (decision).

CRC-32C

Guy Castagnoli, Stefan Bräuer and Martin Herrmann. "Optimization of Cyclic Redundancy-Check Codes with 24 and 32 Parity Bits." IEEE Transactions on Communications 41(6), pp. 883–892, June 1993. https://doi.org/10.1109/26.231911

Relation. The Castagnoli polynomial checksums every WAL record, checksummed wire payload, chunk and replication transfer (decision).

RFC 3720

J. Satran, K. Meth, C. Sapuntzakis, M. Chadalapaka and E. Zeidner. Internet Small Computer Systems Interface (iSCSI). RFC 3720, April 2004. https://www.rfc-editor.org/rfc/rfc3720

Relation. The specification that standardized CRC-32C for storage protocols (Appendix B); Go's crc32.Castagnoli table is the same polynomial.

FNV hash

Glenn Fowler, Landon Curt Noll, Kiem-Phong Vo, Donald Eastlake and Tony Hansen. The FNV Non-Cryptographic Hash Algorithm. IETF Internet-Draft draft-eastlake-fnv. https://datatracker.ietf.org/doc/html/draft-eastlake-fnv

Relation. A stream's partition key is 64-bit FNV-1a over its symbol and exchange (StreamID.PartitionKey).

Parquet

Apache Software Foundation. Apache Parquet — File Format. https://parquet.apache.org/docs/file-format/ · specification repository: https://github.com/apache/parquet-format

Relation. mirexa-cli load reads Parquet files (through github.com/parquet-go/parquet-go); it is linked into mirexa-cli, and never into the client libraries. See Bulk loading files.

Zstandard

Yann Collet and Murray S. Kucherawy (ed.). Zstandard Compression and the 'application/zstd' Media Type. RFC 8878, February 2021. https://www.rfc-editor.org/rfc/rfc8878

Relation. mirexa-cli load reads .zst-compressed CSV (through github.com/klauspost/compress/zstd). Mirexa's own chunks do not use zstd.

gzip

P. Deutsch. GZIP file format specification version 4.3. RFC 1952, May 1996. https://www.rfc-editor.org/rfc/rfc1952

Relation. mirexa-cli load reads .gz-compressed CSV with Go's compress/gzip.

Security

Ed25519

Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe and Bo-Yin Yang. "High-speed high-security signatures." Journal of Cryptographic Engineering 2(2), pp. 77–89, 2012. https://doi.org/10.1007/s13389-012-0027-1

Relation. Session tokens (mirexa-cli token), control-plane admin tokens and the internal CA for node certificates (mirexa-cli certs) all use Ed25519 keys (decision).

RFC 8032

S. Josefsson and I. Liusvaara. Edwards-Curve Digital Signature Algorithm (EdDSA). RFC 8032, January 2017. https://www.rfc-editor.org/rfc/rfc8032

Relation. The specification of the Ed25519 signatures Go's crypto/ed25519 implements.

TLS 1.3

E. Rescorla. The Transport Layer Security (TLS) Protocol Version 1.3. RFC 8446, August 2018. https://www.rfc-editor.org/rfc/rfc8446

Relation. Node-to-node replication requires mutual TLS 1.3 (replication.LoadNodeTLS), and the client listener's security.min_version defaults to 1.3. See TLS and certificates.

A. Barth et al. (ed. S. Bingler, M. West, J. Wilander). Cookies: HTTP State Management Mechanism (RFC 6265bis), IETF HTTP Working Group draft, section on cookie name prefixes. https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis

Relation. On an HTTPS deployment the dashboard's refresh cookie is named __Host-mirexa_refresh and set HttpOnly, Secure, SameSite=Strict, Path=/; the __Host- prefix makes a browser refuse it unless those hold. Over plain HTTP it falls back to mirexa_refresh, because a browser stores no __Host- cookie there (decision).

HSTS

J. Hodges, C. Jackson and A. Barth. HTTP Strict Transport Security (HSTS). RFC 6797, November 2012. https://www.rfc-editor.org/rfc/rfc6797

Relation. The dashboard sends HSTS only when its deployment is HTTPS, because HSTS sent from a plaintext deployment cannot be undone in the browser.

Web and observability

Server-Sent Events

WHATWG. HTML Living Standard — Server-sent events. https://html.spec.whatwg.org/multipage/server-sent-events.html

Relation. The dashboard's live feed is SSE; the event id is the last candle's timestamp, which maps onto how a subscription resumes (decision).

WebSocket

I. Fette and A. Melnikov. The WebSocket Protocol. RFC 6455, December 2011. https://www.rfc-editor.org/rfc/rfc6455

Relation. The alternative refused for the dashboard's one-directional live feed.

Prometheus exposition format

Prometheus Authors. Exposition formats. https://prometheus.io/docs/instrumenting/exposition_formats/

Relation. Nodes and the dashboard expose metrics in this format on their metrics endpoints; the catalog of families is pinned by TestCatalog_IsCurrent. See Metrics.

gRPC keepalive

gRPC Authors. Keepalive. https://grpc.io/docs/guides/keepalive/

Relation. The inter-node connection pool detects dead peers with HTTP/2 keepalive on the connection replication uses; the library floors the client ping interval at 10s.

Rapid Type Analysis

David F. Bacon and Peter F. Sweeney. "Fast Static Analysis of C++ Virtual Function Calls." Proceedings of OOPSLA '96, pp. 324–341, 1996. https://doi.org/10.1145/236337.236371 Implementation: https://pkg.go.dev/golang.org/x/tools/go/callgraph/rta

Relation. make reachcheck builds an RTA call graph from every main to find exported internal symbols nothing reaches (decision).

References

Source

Further reading