scaling database

Too much load

Replicate the master database, build more slaves database
master can keep up all the writes, slaves can keep up all the reads

downsides:

  • doesn't increase write speed
  • replication lag

Too much data

sharding database

downsides:

  • complex queries ( a range query might hit all of you machines)
  • join is difficult or impossible

Generally, the benefits outweigh the downsides

你可能感兴趣的:(scaling database)