Mawg
Mawg

Reputation: 40215

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?

Upvotes: 1

Views: 701

Answers (2)

Anoop
Anoop

Reputation: 1855

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

Upvotes: 2

philwinkle
philwinkle

Reputation: 7056

If you're using MySQL you can look into MySQL Proxy, which handles round-robin and load balancing across multiple servers. Many other RDBMS's have this functionality as well.

Another way to spread the load around is to 'shard' your database, or in other words, create records in multiple systems, and have a way of differentiating/locating which system to retrieve them from. This is a common practice.

For MySQL Server check out 'High Performance MySQL' by O'reily

Upvotes: 1

Related Questions