Apache Cassandra is a distributed, wide-column NoSQL database designed for high availability, horizontal scalability, and fault tolerance. The codebase implements a peer-to-peer cluster architecture with consistent hashing for data placement and tunable replication. The system provides the Cassandra Query Language (CQL) as its primary interface, with a native binary protocol for client communication. Key subsystems include the storage engine (SSTables, memtables, commit log), distributed consensus protocols (legacy Paxos and the newer Accord transactional protocol), cluster metadata management (TCM replacing gossip), and secondary indexing (SASI and Storage-Attached Index SAI). The codebase also includes operational tooling (nodetool CLI, cqlsh shell, stress testing tool, sstable utilities) and extensive testing infrastructure (unit, distributed in-JVM, deterministic simulator, property-based, and microbenchmarks). The architecture follows a modular design with clear separation of concerns: transport layer (Netty-based NIO), query processing (CQL parser, statement execution, result set building), storage (commit log for durability, memtables for writes, SSTables for reads, compaction strategies), and distributed coordination (gossip for failure detection, streaming for bootstrap/repair, hinted handoff for availability). The newer Accord protocol introduces a transactional layer on top of the existing storage engine, enabling ACID transactions across partitions. The codebase is predominantly Java with a Python-based CQL shell (cqlsh) and extensive shell-based build and CI automation. Key entry points include the Cassandra server daemon (started via bin/cassandra), the nodetool CLI (bin/nodetool) for administration, cqlsh (bin/cqlsh) for interactive CQL, and various sstable utilities (sstableloader, sstablescrub, etc.). External dependencies include Netty for networking, Dropwizard Metrics for instrumentation, Picocli for CLI parsing, and various Java libraries for compression, encryption, and serialization. The build system uses Ant with Maven dependency resolution, and the project includes Dockerfiles for containerized builds and testing. The repository also contains formal verification artifacts (TLA+ models) and a deterministic simulation framework for testing distributed correctness, reflecting a strong emphasis on reliability.
Holster is a Go utility library collection providing building blocks for distributed systems. It offers deterministic time control for testing, leader election implementations (etcd-based and Raft-inspired), enhanced error handling with context and stack traces, service discovery (Consul, DNS SRV), OpenTelemetry tracing, caching mechanisms (LRU, TTL, ExpireCache), retry utilities, HTTP request signing, gRPC connection pooling, and MX record resolution. Designed as drop-in replacements for standard library components with enhanced functionality, it focuses on solving common infrastructure challenges in microservices architectures. The library maintains a clear separation of concerns with each package addressing a specific cross-cutting concern.
This repository contains the original open-source codebase for reddit, the social news aggregation and discussion platform. It is a monolithic web application built on the Pylons framework (Python 2), serving both a server-rendered frontend (Mako templates, jQuery, Backbone) and a REST-like API. The architecture relies on multiple data stores: PostgreSQL for core entities (things), Cassandra for high-write data (votes, comments trees, view counts), Memcached/McRouter for caching, and RabbitMQ for asynchronous job processing. It includes a full advertising system, user awards/gold, moderation tools, a wiki, and traffic analytics. While the codebase is archived and relies on heavily outdated dependencies (Python 2, Pylons, pycassa), it showcases several well-designed internal patterns such as a pluggable provider system, a layered cache chain with stale-while-revalidate, and a feature flag framework for A/B testing. These components demonstrate non-trivial engineering skill and could be extracted for reuse. However, the vast majority of the codebase is tightly coupled to reddit-specific models and global state, limiting reusability without significant adaptation.