Quick reference for replication, sharding, isolation levels, quorums, 2PC vs Saga, and NewSQL.
ShardingReplicationCAPNewSQL
ACID vs BASE
| ACID | BASE |
| Atomicity, Consistency | Basically Available |
| Isolation, Durability | Soft state, Eventual consistency |
NoSQL families
| Type | Examples |
| Key-value | Redis, DynamoDB |
| Document | MongoDB, Couchbase |
| Wide-column | Cassandra, ScyllaDB |
| Graph | Neo4j, Neptune |
Indexes
| Index | Best at |
| B-tree | Range + equality; read-optimized |
| Hash | Exact match O(1), no ranges |
| LSM-tree | Write-heavy; compaction cost |
| Inverted | Full-text search |
Replication
| Topology | Trade-off |
| Single-leader | Simple; leader bottleneck/SPOF |
| Multi-leader | Regional writes; conflicts |
| Leaderless | HA; read-repair needed |
Sync = no loss, higher latency
Async = fast, lag + possible loss
Quorum: W + R > N => read sees latest write
Sharding
| Strategy | Downside |
| Range | Hot spots on sequential keys |
| Hash | No range queries |
| Directory | Lookup is SPOF |
Avoid hash % N (add node -> reshuffle all)
Consistent hashing / fixed partitions -> move ~1/N keys
Virtual nodes -> even load
Isolation Levels
| Level | Dirty | Non-rep | Phantom |
| Read Uncommitted | Y | Y | Y |
| Read Committed | N | Y | Y |
| Repeatable Read | N | N | Y* |
| Serializable | N | N | N |
*InnoDB blocks phantoms with next-key locks.
2PC vs Saga & NewSQL
| 2PC | Saga |
| Atomicity | Strong | Compensations |
| Blocking | Yes | No |
CAP lean
| CP | Spanner, HBase, etcd, Mongo (majority) |
| AP | Cassandra, DynamoDB, Riak |
NewSQL: Spanner (TrueTime), CockroachDB/Yugabyte (Raft KV + SQL), Vitess (sharded MySQL). OLTP row-store vs OLAP column-store. Sync caches/indexes via CDC (Debezium → Kafka). Pool connections (PgBouncer).