You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Lev Stesin <le...@gmail.com> on 2010/06/17 21:08:35 UTC
3-node balanced system
Hi,
What is the correct procedure to create a well balanced cluster (in
terms of key distribution). From what I understand whenever I add a
new node its takes half from its neighbor. How can I make each node to
contain 1/3 of the keys in a 3 node cluster? Thanks.
--
Lev
Re: 3-node balanced system
Posted by Ran Tavory <ra...@gmail.com>.
+ user, - dev (bcc actually)
If you use a random partitioner use the following InitialToken for your
nodes:
$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
(2^127)/3
*56713727820156410577229101238628035242*
((2^127)/3)*2
*113427455640312821154458202477256070484*
((2^127)/3)*3
*170141183460469231731687303715884105726*
On Thu, Jun 17, 2010 at 10:08 PM, Lev Stesin <le...@gmail.com> wrote:
> Hi,
>
> What is the correct procedure to create a well balanced cluster (in
> terms of key distribution). From what I understand whenever I add a
> new node its takes half from its neighbor. How can I make each node to
> contain 1/3 of the keys in a 3 node cluster? Thanks.
>
> --
> Lev
>
Re: 3-node balanced system
Posted by Ran Tavory <ra...@gmail.com>.
+ user, - dev (bcc actually)
If you use a random partitioner use the following InitialToken for your
nodes:
$ bc
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
(2^127)/3
*56713727820156410577229101238628035242*
((2^127)/3)*2
*113427455640312821154458202477256070484*
((2^127)/3)*3
*170141183460469231731687303715884105726*
On Thu, Jun 17, 2010 at 10:08 PM, Lev Stesin <le...@gmail.com> wrote:
> Hi,
>
> What is the correct procedure to create a well balanced cluster (in
> terms of key distribution). From what I understand whenever I add a
> new node its takes half from its neighbor. How can I make each node to
> contain 1/3 of the keys in a 3 node cluster? Thanks.
>
> --
> Lev
>
Re: 3-node balanced system
Posted by Mark Robson <ma...@gmail.com>.
On 17 June 2010 20:08, Lev Stesin <le...@gmail.com> wrote:
> Hi,
>
> What is the correct procedure to create a well balanced cluster (in
> terms of key distribution). From what I understand whenever I add a
> new node its takes half from its neighbor. How can I make each node to
> contain 1/3 of the keys in a 3 node cluster? Thanks.
>
It depends what replication factor you use.
If you use a replication factor of three, all data goes into all three of
your nodes, hence it will always be well-balanced.
If you use a factor of two, all data goes into two nodes and it may not be
well balanced. It depends on which partitioner you use and how you select
your keys in your application. If you use the random partitioner and have a
large number of keys with data evenly spread, you have nothing to worry
about.
If you use OrderPreservingParitioner then you can easily run into trouble.
Normally the tokens get chosen semi-randomly (initially) and then to
subdivide the existing ones(later) during bootstrap.
If you have keys which steadily increase (e.g. time-based) then you tend to
get unbalanced clusters anyway. You should then probably consider which part
of the key you really need to do range scans on, and consider hashing part
that you don't.
Mark
Re: 3-node balanced system
Posted by Ran Tavory <ra...@gmail.com>.
so bc and ruby agree ;)
On Thu, Jun 17, 2010 at 10:20 PM, Benjamin Black <b...@b3k.us> wrote:
> in ruby:
>
> def token(nodes) 1.upto(nodes) {|i| p (2**127/nodes) * i}; end
>
> >> token(3)
> 56713727820156410577229101238628035242
> 113427455640312821154458202477256070484
> 170141183460469231731687303715884105726
>
>
> On Thu, Jun 17, 2010 at 12:08 PM, Lev Stesin <le...@gmail.com> wrote:
> > Hi,
> >
> > What is the correct procedure to create a well balanced cluster (in
> > terms of key distribution). From what I understand whenever I add a
> > new node its takes half from its neighbor. How can I make each node to
> > contain 1/3 of the keys in a 3 node cluster? Thanks.
> >
> > --
> > Lev
> >
>
Re: 3-node balanced system
Posted by Benjamin Black <b...@b3k.us>.
in ruby:
def token(nodes) 1.upto(nodes) {|i| p (2**127/nodes) * i}; end
>> token(3)
56713727820156410577229101238628035242
113427455640312821154458202477256070484
170141183460469231731687303715884105726
On Thu, Jun 17, 2010 at 12:08 PM, Lev Stesin <le...@gmail.com> wrote:
> Hi,
>
> What is the correct procedure to create a well balanced cluster (in
> terms of key distribution). From what I understand whenever I add a
> new node its takes half from its neighbor. How can I make each node to
> contain 1/3 of the keys in a 3 node cluster? Thanks.
>
> --
> Lev
>