Cassandra primer
A practical introduction to Apache Cassandra for engineers building high-throughput, globally distributed services on Meridian. This recipe walks through the data model, partition strategy, and the query patterns that keep tail latency flat under load.
1.Model around your queries
Cassandra rewards denormalized, query-first schemas. Pick a partition key that spreads writes evenly and groups rows that are read together. Avoid unbounded partitions: a single partition that grows forever will eventually compact poorly and starve coordinators.
CREATE TABLE events_by_user ( user_id uuid, bucket date, ts timeuuid, payload text, PRIMARY KEY ((user_id, bucket), ts) ) WITH CLUSTERING ORDER BY (ts DESC);
2.Tune consistency per call site
Meridian exposes consistency as a per-statement flag. Use LOCAL_QUORUM for writes that must survive a single AZ outage, and LOCAL_ONE for read-mostly feeds where stale-by-seconds is acceptable. Reserve EACH_QUORUM for the handful of cross-region records that absolutely cannot diverge.
3.Watch the right metrics
Three signals predict almost every Cassandra incident: p99 coordinator latency, pending compactions, and partition size at the 99th percentile. Meridian ships dashboards for all three out of the box; alert on sustained deviation rather than single spikes to avoid pager fatigue.