2011/2/3 Oleg Proudnikov <olegp@cloudorange.com&g= t;
ruslan usifov <ruslan.usifov <at> gmail.com> writes:

>
>
> 2011/2/3 Oleg Proudnikov <olegp <at> cloudorange.com>
> Is it possible that the key "12= 12" maps to the first node? I am assuming RF=3D1.
> You could try random keys to test this theory...
>
>
> Yes you right "1212" goes to first node. I distribute tokens= like described in
"Operations":
http://wiki.apache.org/cassandra/O= perations:085070591730234615865843651857942052864So
delay in my second experiment(where i got big delay in insert), appear as r= esult
of delay communications between nodes?
>

That was the theory, assuming you are using replication factor = of 1.

It is difficult to say where the key falls just by looking at the ring - ra= ndom
partitioner could through this key on either node. After writing 1 million = rows

Hm this is very simple to calculate for rand= om, partitioner, this script on python do that:

from hashlib import = md5;

def tokens(nodes):
=A0 l_retval =3D [];

=A0 for x in xrange(n= odes):
=A0=A0=A0 l_retval.append(2 ** 127 / nodes * x);

=A0 retur= n l_retval;

def wherekey(key, orderednodetokens):
=A0 l_m =3D md5= ();
=A0 l_m.update(key);
=A0 l_keytoken =3D long(l_m.hexdigest(), 16);

=A0 l_found =3D False;=
=A0 l_i =3D 0;

=A0 for l_nodetoken in orderednodetokens:
=A0= =A0=A0 if l_keytoken <=3D l_nodetoken:
=A0=A0=A0=A0=A0 l_found =3D Tr= ue;
=A0=A0=A0=A0=A0 break;

=A0=A0=A0 l_i +=3D 1;

=A0 if l_found:
=A0=A0=A0 return l_i;

=A0 return 0;

ri= ng =3D tokens(2);
print wherekey("1212", ring);

So = for key "1212" will by chosen 0 node. 10.24.84.4 in my case