当人们谈论使用“分片”扩展网站时,它们意味着什么?

时间:2021-08-16 20:05:27

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?

我已经听过几次提到的关于解决大型网站缩放问题的“碎片”技术。什么是'碎片'技术,为什么这么好?

3 个解决方案

#1


9  

Karl Seguin has a good blog post about sharding.

Karl Seguin有一篇关于分片的博文。

From the post:

从帖子:

Sharding is the separation of your data across multiple servers. How you separate your data is up to you, but generally it’s done on some fundamental identifier.

分片是指跨多个服务器分离数据。您如何分离数据取决于您,但通常是基于某些基本标识符。

#2


2  

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.

简而言之,想象一下将users_tbl分隔到多个服务器上。所以用户1-5000和服务器1,用户5000-10000在服务器2上;如果您的数据模型在代码中足够抽象,那么代码通常不会发生巨大变化。

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.

当然,如果所有查询都类似于“SELECT COUNT(*)FROM users_tbl GROUP BY userType”,但是当你的位置是“WHERE userid = 5”时,这种方法会变得很困难,那么它就更有意义了。

#3


2  

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.

由于“分片”是大型网站架构原则的一部分,您可能有兴趣在这里听“使用Randy Shoup的'eBay架构原则'。

#1


9  

Karl Seguin has a good blog post about sharding.

Karl Seguin有一篇关于分片的博文。

From the post:

从帖子:

Sharding is the separation of your data across multiple servers. How you separate your data is up to you, but generally it’s done on some fundamental identifier.

分片是指跨多个服务器分离数据。您如何分离数据取决于您,但通常是基于某些基本标识符。

#2


2  

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.

简而言之,想象一下将users_tbl分隔到多个服务器上。所以用户1-5000和服务器1,用户5000-10000在服务器2上;如果您的数据模型在代码中足够抽象,那么代码通常不会发生巨大变化。

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.

当然,如果所有查询都类似于“SELECT COUNT(*)FROM users_tbl GROUP BY userType”,但是当你的位置是“WHERE userid = 5”时,这种方法会变得很困难,那么它就更有意义了。

#3


2  

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.

由于“分片”是大型网站架构原则的一部分,您可能有兴趣在这里听“使用Randy Shoup的'eBay架构原则'。