Search code examples
database-replicationdistributed-transactions

How do I "distribute" a database?


Until now my "database server" has been happy with being a single PC.

Unfortunately the load is becoming too much, so it looks like I need to "distribute" the database.

What exactly does that entail? How can I spread my database across several servers? And do I need an intermediate server which users query & somehow distributes the load to the 'real' database servers?

How does that work for database write and for database read?

Any beginner 101 websites or books?


Solution

  • What exactly is the bottleneck with a single database. Is it

    • Read performance
    • Write performance

    Few approaches used by high traffic websites.

    • Using master/slave model. Add one or more servers and make them as slaves to your master database. All writes will be performed on your master. Reads can performed from any of the slaves. This can be the simplest approach.

    • Sharding. Entities which does not need joins can be moved to a different database servers. Each shard can inturn have its own master-slave servers.

      http://www.codefutures.com/database-sharding/

    • Clustering - Oracle RAC, Mysql NDB can provide clustering where a set of servers acts as a single unit.

      http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster-overview.html