flowchart TD
app[Application]
cach[Memcached]
db[Slow database]
app --"Store data in cache (set)"--> cach
cach --"Get data from cache (get)"--> app
db -.-> app
- Web Server
- Database Server
- Database Write
Sharding: Split a database into multiple databases
- Verticle Sharding: Each table into different machines
- Horizontal Sharding: Deal with a single really large table. One technique is sharding the table based on row IDs
- A master table is needed to store sharding 'ID'
- for NoSQL Databases: Easy for scaling with Key-value structure
- Database Write
Sharding: Split a database into multiple databases
- Media Server
- Client - Server
- Data transport mechanism
- Json
- Protocol buffer
- Security
- Offline-Usage
- Speed
- Consistence Hashing
- e.g: Cassandra, redis, riak, DynamoDB
- Fast. Suitable for data storage rather than web caching distribution Consistence hashing paper
- Geo Hash /Quad trees
- Recursively subdividing 2D space into four quadrants. Each node represents a region and has 0-4 child nodes
- Fast location based insertion and searches. Suitable for mapping app
- Extend: R-trees, JD trees
- Leaky bucket / Ray limiting
- dataflow through 'leak', and turned away when overflowed until there's room again
- Simple. Bucket size control burst capacity. Control leak rate.
- Token bucket algorithm, Sliding windown counter algoritm
- Trade off Accuracy-Perfomance
- Tries
- Tree of nodes
- Fast looking speed
- Foundation for scalable string based searches
- Bloom Filter
- Probabilistic data structure for set membership checks
- " is W in the set?". Answer: Firm NO, or Probably YES
- Less memory required, but less accurate
- Consensus algorithms
- Paxos, Raft
- Simplicity, Efficiency
- Prevent Downtime
- e.g: Kafka, Etcd