<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Consistent Hashing</title>
	<atom:link href="http://ma.tt/2008/03/consistent-hashing/feed/" rel="self" type="application/rss+xml" />
	<link>http://ma.tt/2008/03/consistent-hashing/</link>
	<description>Unlucky in Cards</description>
	<lastBuildDate>Mon, 30 Jan 2012 18:53:13 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19904</generator>
	<item>
		<title>By: David Pankhurst</title>
		<link>http://ma.tt/2008/03/consistent-hashing/#comment-440935</link>
		<dc:creator>David Pankhurst</dc:creator>
		<pubDate>Thu, 03 Apr 2008 06:42:22 +0000</pubDate>
		<guid isPermaLink="false">http://ma.tt/?p=4892#comment-440935</guid>
		<description>...of course, the above assumes all data is equal, and any server pick is as good as another. If you need consistency (say like the original article, where a specific key goes to the same server each time) then you don&#039;t want mt_rand() - the recommendation of md6(keyvalue) works well until # of servers change.</description>
		<content:encoded><![CDATA[<p>&#8230;of course, the above assumes all data is equal, and any server pick is as good as another. If you need consistency (say like the original article, where a specific key goes to the same server each time) then you don&#8217;t want mt_rand() &#8211; the recommendation of md6(keyvalue) works well until # of servers change.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Pankhurst</title>
		<link>http://ma.tt/2008/03/consistent-hashing/#comment-440934</link>
		<dc:creator>David Pankhurst</dc:creator>
		<pubDate>Thu, 03 Apr 2008 05:30:37 +0000</pubDate>
		<guid isPermaLink="false">http://ma.tt/?p=4892#comment-440934</guid>
		<description>This is actually an old trick for randomly picking from uneven lists:
1-Create an array, with each entry representing the server capacity.
2-Now pick a random number from this total.
3-Find the server that represents that position in the list.
Eg:
$server=array(10,50,20,7);
$x=mt_rand(0,array_sum($server)-1);
$i=-1;
while ($x-$server[++$i]&gt;=0) $x-=$server[$i];
// or more cryptic but faster: 
// while ( ($x-=$server[++$i]) &gt;= 0 ) {;}

The server to use is &#039;$i&#039;.

You can get fancier, but that will split based on &#039;how much&#039; each can handle of the whole.</description>
		<content:encoded><![CDATA[<p>This is actually an old trick for randomly picking from uneven lists:<br />
1-Create an array, with each entry representing the server capacity.<br />
2-Now pick a random number from this total.<br />
3-Find the server that represents that position in the list.<br />
Eg:<br />
$server=array(10,50,20,7);<br />
$x=mt_rand(0,array_sum($server)-1);<br />
$i=-1;<br />
while ($x-$server[++$i]&gt;=0) $x-=$server[$i];<br />
// or more cryptic but faster:<br />
// while ( ($x-=$server[++$i]) &gt;= 0 ) {;}</p>
<p>The server to use is &#8216;$i&#8217;.</p>
<p>You can get fancier, but that will split based on &#8216;how much&#8217; each can handle of the whole.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

