TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Shuffle Sharding: massive and magical fault isolation

50 点作者 motter大约 11 年前

3 条评论

notacoward大约 11 年前
Great stuff, but the same generally beneficial approach taken too far can run into its own problems.<p><a href="http://hackingdistributed.com/2014/02/14/chainsets/" rel="nofollow">http:&#x2F;&#x2F;hackingdistributed.com&#x2F;2014&#x2F;02&#x2F;14&#x2F;chainsets&#x2F;</a><p>To put it simply, seven million is not a big number, and it&#x27;s the wrong number anyway. The author confused permutations and combinations; the correct number of four-card hands from a deck including jokers is only 316251. For the more common N=3 it&#x27;s a paltry 24804. If you&#x27;re doing &quot;pick any N&quot; to choose replica sets for millions of objects (for example) then pretty quickly every node will have a sharding relationship with every other. The probability of a widespread failure wiping out every member of <i>some</i> shard - leading to loss of data or service - approaches one. You&#x27;re better off constraining the permutations somehow, certainly not all the way down to the bare minimum, but so that the total probability of data&#x2F;service loss after N failures remains small.<p>I really hope people actually do the math instead of just cargo-culting an idea with a catchy name.
评论 #7598703 未加载
评论 #7601480 未加载
danudey大约 11 年前
Our approach has turned out to work really well, and very simply.<p>We have N servers in round-robin DNS. When our mobile client starts up, it does a DNS lookup, fetches the entire list of servers, and then picks one to connect to. If that connection fails, it tries another one, etc. until it runs out (which has never happened).<p>We also ship the client with a pre-populated list of IP addresses (the current server list as of build time) and the client caches the list it gets from DNS whenever it does a lookup. This means that even in the event of a complete DNS failure, even for hours at a time, our clients are still able to connect. This was quite handy when GoDaddy&#x27;s DNS was inaccessible a year or two ago due to what I recall was a DDoS attack.<p>A few weeks ago my ISP&#x27;s DNS servers went down, and since I have the same mobile and DSL provider, I was completely unable to do anything on the internet — except play our game. It was then that I wondered &#x27;why don&#x27;t more apps do this?&#x27; It seems like a simple problem; if you can&#x27;t do a DNS lookup, assume the previous IP is still valid. Assuming you&#x27;re using HTTPS, there should be no more exposure from a security perspective unless someone takes control of your IP address <i>and</i> fakes your SSL certificate, at which point you&#x27;re screwed anyway.
评论 #7602373 未加载
mey大约 11 年前
Quick note about client retry, I highly suggest some type of guard on side effecting operations, either rejecting duplicate transaction ids (generated by the client or retrieved from the server before the side effecting operation) or returning the previous result if the transaction id was recently processed.<p>Obviously being stateful and correctly routing the request across shards becomes harder and can hurt this scale out solution. It also depends on the functionality of the request, for example an update of the same data may not cause any damage, but a double submit of an order could be.<p><a href="https://en.wikipedia.org/wiki/Idempotence#Computer_science_meaning" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Idempotence#Computer_science_m...</a>