Hash
A calculation that turns any text (an IP, a URL) into a number. Distributing by hash uses that number to always pick the same server.
Example
The IP 190.64.1.20 always hashes to 2, so that user always goes to server 2 of 3.
Test yourself: Hash
Load balancers
With hashing on the IP, the same user always lands on the same server.
The IP 190.64.1.20 always gives the same hash number, say 2: that user always goes to server 2.
0/1
â–¶ PlayLessons that use it
Load balancers
Sharing the work
Big O notation
How much does it grow?
Arrays
Adjacent cells
Linked lists
Links of a chain
Hash tables
From key to slot in 1 calculation
Hash collisions
When 2 keys want the same spot
Hash algorithms
A good hash spreads evenly
Graph operations
Adding and removing vertices and edges
Searching with a hash
From O(n²) to O(n) with a table
Choosing how to search
Brute force or using the order
Sharding
Splitting the database into pieces
Consistent hashing
A ring to split the load
Idempotency
Repeat without breaking anything
Generating unique keys
Where 3I71d3o comes from
