算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
core-algorithms-system-design【设计与创意】Mathematical and architectural analysis of Consistent Hashing, Rate Limiting, and Bloom Filters.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Standard modulo hashing (hash(key) % N) causes catastrophic remapping when a node is added or removed, invalidating (N-1)/N keys.
Consistent Hashing maps keys and nodes onto a conceptual ring (e.g., integer range [0, 2^32-1]). A key belongs to the first node encountered clockwise.
K/N keys.B tokens. Tokens are added at a constant rate R. A request consumes N tokens. If empty, the request is rejected. It allows bursts up to the bucket capacity while sustaining long-term rate R.Q. A background process dequeues and processes them at a constant rate R. Burst traffic fills the queue; excess is dropped (traffic shaping).A Bloom Filter is a space-efficient probabilistic data structure used to test set membership.
m bits initialized to 0. k independent hash functions map an item to k bit indices, setting them to 1.k times. If all k bits are 1, it is probably in the set. If any bit is 0, it is definitely not.p depends on bits m, inserted elements n, and hash functions k. Optimal k = (m/n) * ln(2). Highly utilized in LSM-Trees to skip reading SSTables that do not contain a key.%%{init: {"theme": "default", "flowchart": {"useMaxWidth": true}}}%%
flowchart TD
A[Core Algorithms]
A --> B[Consistent Hashing]
B --> B1[Hash Ring Topology]
B --> B2[Clockwise Key Lookup]
B --> B3[Virtual Nodes: Load Balancing]
A --> C[Rate Limiting]
C --> C1[Token Bucket: Burst Allowed]
C --> C2[Leaky Bucket: Traffic Smoothing]
A --> D[Bloom Filters]
D --> D1[m bit array & k hash functions]
D --> D2[Zero False Negatives]
D --> D3[Optimal k = m/n * ln2]