Skip to content

Scaling

Web server Scaling

  • vertical scaling(scale up) : adding more power(CPU, RAM)
    • πŸ’‘ When traffic is low, vertical scaling is a great option
    • βœ… simplicity
    • β›” has a hard limit, it is impossible to add unlimited CPU and memory
    • β›” does not have failover and redundancy
  • horizontal scaling(scale out): adding more services into your poll of resources
    • πŸ’‘ for large scale applications due to the limitations of vertical scaling
    • βœ… failover and redundancy
    • β›” difficult

Database Scaling

  • vertical scaling(scale up) : adding more power(CPU, RAM)
    • πŸ’‘ When traffic is low, vertical scaling is a great option
    • Amazon RDS 24 TB of RAM . For example, stackoverflow.com in 2013 had over 10 million monthly unique visitors, but it only had 1 master database
    • βœ… simplicity
    • β›” has a hard limit, it is impossible to add unlimited CPU and memory
    • β›” does not have failover and redundancy
    • β›” The overall cost of vertical scaling is high. Powerful servers are much more expensive
  • horizontal scaling(sharding): adding more services into your poll of resources
    • πŸ’‘ for large data due to the limitations of vertical scaling
    • πŸ’‘sharding key examples- user_id % 4
      • When choosing a sharding key, one of the most important criteria is to choose a key that can evenly distributed data.
    • βœ… failover and redundancy
    • β›” complexity and new challenges
      • Resharding data
      • Celebrity problem.To solve this problem, we may need to allocate a shard for each celebrity. Each shard might even require further partition.
      • Join and de-normalization. A common workaround is to de- normalize the database so that queries can be performed in a single table.