Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 99263 invoked from network); 3 Feb 2011 07:58:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2011 07:58:51 -0000 Received: (qmail 69154 invoked by uid 500); 3 Feb 2011 07:58:49 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 68780 invoked by uid 500); 3 Feb 2011 07:58:46 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 68769 invoked by uid 99); 3 Feb 2011 07:58:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Feb 2011 07:58:45 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ruslan.usifov@gmail.com designates 74.125.83.172 as permitted sender) Received: from [74.125.83.172] (HELO mail-pv0-f172.google.com) (74.125.83.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Feb 2011 07:58:38 +0000 Received: by pvc21 with SMTP id 21so194299pvc.31 for ; Wed, 02 Feb 2011 23:58:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=eMqLKzDIaVT7oeh3fepfcs+wFc77IpiG98ACtqBz7ec=; b=Igy2vSJPXJ48zAPe8N/pGjCHwy3hW1NX5rjnUo1o9fDOAwe7HpdAnwfwqiOZ9vT66w lVpflXdJN2Ozku7L4tM+yphIb2gHE4ZCWnNq+NGz2F9DPpNMbgW1G4uljphnFOjm4mjf jJZPgwZHJC0ScZQ1xSBvP4ymZGwL+wgbYeYCU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=Z2ITfBgxYi4ROmXxi0hePrRyRlEDyjcqmT1icByPResRZXzB62S06FQLRyUoPqulIA eT1+IPwDRtzHczCUt+kleJ+Fs+yCHbwAdSaIWWmdfNA5IeEb4HpI+eadjYc+be0rhYLq UF/wSPBckS65zf9l9UkcSP2PPM9AsXRMxxcdI= MIME-Version: 1.0 Received: by 10.142.191.3 with SMTP id o3mr9799084wff.105.1296719897113; Wed, 02 Feb 2011 23:58:17 -0800 (PST) Received: by 10.143.161.2 with HTTP; Wed, 2 Feb 2011 23:58:17 -0800 (PST) In-Reply-To: References: Date: Thu, 3 Feb 2011 10:58:17 +0300 Message-ID: Subject: Re: Slow network writes From: ruslan usifov To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=000e0cd2118ad7346f049b5c20c5 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd2118ad7346f049b5c20c5 Content-Type: text/plain; charset=ISO-8859-1 2011/2/3 Oleg Proudnikov > ruslan usifov gmail.com> writes: > > > > > > > 2011/2/3 Oleg Proudnikov cloudorange.com> > > Is it possible that the key "1212" maps to the first node? I am assuming > RF=1. > > 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/Operations:085070591730234615865843651857942052864So > delay in my second experiment(where i got big delay in insert), appear as > result > 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 - > random > partitioner could through this key on either node. After writing 1 million > rows > Hm this is very simple to calculate for random, partitioner, this script on python do that: from hashlib import md5; def tokens(nodes): l_retval = []; for x in xrange(nodes): l_retval.append(2 ** 127 / nodes * x); return l_retval; def wherekey(key, orderednodetokens): l_m = md5(); l_m.update(key); l_keytoken = long(l_m.hexdigest(), 16); l_found = False; l_i = 0; for l_nodetoken in orderednodetokens: if l_keytoken <= l_nodetoken: l_found = True; break; l_i += 1; if l_found: return l_i; return 0; ring = tokens(2); print wherekey("1212", ring); So for key "1212" will by chosen 0 node. 10.24.84.4 in my case --000e0cd2118ad7346f049b5c20c5 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

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
--000e0cd2118ad7346f049b5c20c5--