Bea.AI design blog
  • System design algorithms
    • Consistant Hashing, Bloom Filter, SkipLists, B-Tree, LRU/LFU
    • Reverse index, Inverted index, Trie, Rsync, Merkle tree
    • Leaky bucket/Token bucket, GeoHash, Quadtree, Leader election, Consensus
    • Time sync, Erasure coding, Message digest, Atomic commit, Mutual exclusion
    • Global state collection, Gossip, Replica management, Self-stabilization, HyperLoglog
    • Count-min Sketch, Hierarchial timing, Operational transform, Last write Wins, Vector clocks
  • Systems design
    • Metrics monitor & alart system
    • API gateway
    • Distributed Key-Value Storage
    • Distributed notification system
    • Task Scheduler
    • Elevator System
  • General Design Templates
    • System Design Blueprint
  • Design topics
    • Topics 1
    • Topics 2
    • Topics 3
    • Topics 4
    • Topics 5
    • Topics 6
    • Topics 7
    • Topics 8
    • Topics 9
    • Topics 10
    • Topics 11
    • Topics 12
    • Topics 13
    • Topics 14
    • Topics 15
    • Topics 16
    • Topics 17
    • Topics 18
    • Topics 19
    • Topics 20
    • Topics 21
    • Topics 22
    • Topics 23
  • System design interview steps & template
  • Typical systems and tips
  • Behaviour Questions
  • Roles requirement
    • SDE-traffic-apple
    • SDE-tools-linkedin
  • Common Systems to use in system design
    • Kafka
    • Flink
    • InfluxDB & Prometheus
    • Kubernetes & Docker
    • Zoomkeeper & Etcd
    • Redis
    • Distributed transaction
  • Design Patterns and Use Scenarios
    • Pattern to creating objects
    • Object Assembling
    • Object Interaction / Responsibility
  • Micro-service network / Gateway
    • Basic concept
    • Performance analysis & optimization
    • Open source techs
  • Systems
    • Distributed Priority Queue
    • Design a Live Video Streaming Platform
Powered by GitBook
On this page

Typical systems and tips

  • TinyUrl service / PasteBin

    • Short url length and characters space determine the urls to support

    • How to generate the key and map with the url

      • Method 1: real time generation, expensive to avoid duplicates

      • Method 2: pre generation, need to avoid using the same key

    • How to expire the expired urls with ttl

      • Proactively cleanup is expensive

      • Could check while accessing and remove it async, another job running to cleanup with a longer running frequency to reduce the impact

    • Cache is required to provide fast access

  • Instagram photo sharing service

    • Storage sharding: Photo data sharding

    • Metadata sharding

    • NewsFeed pre-generation, rather than real-time quering

  • Distributed key-value database

    • Data model

      • Sequencer is very important for resolve confliction, each row will have a unique sequenceId, could use last write win

    • Cluster/Replication group

      • 3 or 5 nodes in a cluster

      • Majority win, for strong consistency, only leader node serves write and read request. If we prefer availability over consistency, the follower nodes can serve read requests.

      • To resolve notes failure/partition, or split brains (two leaders), for the reads/writes, it could confirm the leadership with majority of the nodes.

    • Data-plane

      • Write-ahead log + B-Tree/LSM tree

    • Metadata Management Service

      • Leader selection with consensus algorithms

      • Manage the table/partition mapping with the key, the control-plane would load the mapping in memory, and the data should keep as up-to-date as possible

    • Workload management service

      • Sharding hot tables to more clusters/replication group. For queues, since there is not identify for each message, it can be just sharded to multiple clusters, don't need to track which message on wich cluster. But for key/value store, the key-range to cluster mapping is needed, and it need to be changed while sharding. During the sharding, there could be a period of time, the both cluster could serve read request, until the copy finished.

    • Control-plane

      • Authorization, authentication

      • Rate limit, circuit breaker

      • Metering, customer facing exception transform

PreviousSystem design interview steps & templateNextBehaviour Questions

Last updated 1 year ago