当人们谈论使用“分片”扩展网站时,他们是什么意思?
我曾多次听到关于解决大型网站的扩展问题的“分片”技术。 这种“碎片”技术是什么?为什么它这么好?
I have heard the 'shard' technique mentioned several times with regard to solving scaling problems for large websites. What is this 'shard' technique and why is it so good?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Karl Seguin 有一个不错的博客关于分片的帖子。
来自帖子:
Karl Seguin has a good blog post about sharding.
From the post:
简而言之,想象一下将 users_tbl 分布在多个服务器上。 因此,用户 1-5000 在服务器 1 上,用户 5000-10000 在服务器 2 上; 等等。如果您的数据模型在代码中足够抽象,那么通常不会对代码进行巨大的更改。
当然,如果您的所有查询都类似于“SELECT COUNT(*) FROM users_tbl GROUP BY userType”,那么这种方法会变得很困难,但是当您的 where 是“WHERE userid = 5”时,它就更有意义了。
In brief, imagine seperating your users_tbl across several servers. So Users 1-5000 and on Server 1, Users 5000-10000 on Server 2; etc. If your data model is sufficiently abstract in code, it's often not a huge change in code.
Of course this approach becomes difficult if all your queries are similar to "SELECT COUNT(*) FROM users_tbl GROUP BY userType" but when your where is "WHERE userid = 5" then it makes more sense.
由于“分片”是大型网站架构原则的一部分,您可能有兴趣聆听“Randy Shoup 的 eBay 架构原则”此处。
As 'sharding' is part of the architecture principles for large websites, you may be interested in listening to 'eBay's Architecture Principles with Randy Shoup' here.