Low Level Design: Rate Limiting Algorithms Deep Dive
Token Bucket The token bucket algorithm models a bucket of capacity B tokens that refills at rate R tokens per […]
Token Bucket The token bucket algorithm models a bucket of capacity B tokens that refills at rate R tokens per […]
Trie Node Structure Each node in a trie holds a fixed-size array of 26 child pointers (one per lowercase letter)
Query Parsing Query execution begins with parsing the raw SQL text. A lexer (scanner) tokenizes the input into keywords, identifiers,
Compare-and-Swap (CAS) Compare-and-Swap is the atomic instruction at the heart of all lock-free algorithms. It takes three operands: a memory
Mutex Basics A mutex (mutual exclusion lock) guarantees that only one thread can hold it at any given time. The
Stack vs Heap Allocation Every running program uses two distinct memory regions for dynamic data: the stack and the heap.
Three-Way Handshake Every TCP connection begins with a three-way handshake that establishes synchronized sequence numbers on both sides and verifies
Write Path Every write in an LSM-tree storage engine lands first in two places simultaneously: the in-memory MemTable and the
Core Concept: How MVCC Works Multi-Version Concurrency Control (MVCC) solves a fundamental database problem: how to allow readers and writers
B-Tree Node Structure A B-tree of minimum degree t enforces a capacity invariant on every node except the root: each
Structure A skip list is a probabilistic data structure that maintains a sorted collection and supports O(log N) expected time
Core Problem LFU (Least Frequently Used) is a cache eviction policy that removes the item with the lowest access frequency
Core Data Structure An LRU cache combines two data structures to achieve O(1) time for every operation. The doubly linked
Provider Schedule Model A provider’s schedule is defined at two levels: recurring availability rules and date-specific overrides. Recurring rules describe
Double-Entry Accounting A digital wallet is a ledger, and the correct foundation for any ledger is double-entry accounting. Every financial