开发者

How do I "distribute" a database?

开发者 https://www.devze.com 2023-02-10 07:04 出处:网络
开发者_开发知识库Until now my "database server" has been happy with being a single PC.

开发者_开发知识库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?


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号