Subscribed unsubscribe Subscribe Subscribe

SE Can't Code

A Tokyo based Software Engineer. Not System Engineer :(

Tips, Scaling Databases.

When you think about Scaling Databases, there are two ploblems.

First problem is too much load.

If there is a million requests at a day and data Storage is one machine, Databeses can’t keep up with all the work. In this case, Replicating other Database is good way. So every time we insert a piece of data to this master database, Slave databases which has same data is created. This slave database is Replicating database. In turn, all of that data gets replicated to these slave databases. If you got a site that’s getting thousands and thousands of requests a second, instead of reading master database, you can send many requests to slave databases. So It’s Scaling this up.

But there are downsides below:

  • doesn’t increase write speed.
  • replicating lag.

Second problem is too much data.

If you have a big data and your database can’t even hold of your data, what should you do ? One of the thing you can do is you can shard the database. You might have a couple that are all the same size of master database. And Big data is shared by these databases. Popular approach of sharing databases is the hash table. It is so cool.

But there are downsides below:

  • complex queries. (range query)
  • joins become difficult.

It’s something that replicating a database can help with and sharding a database can help with.

Remove all ads