From user-return-59403-archive-asf-public=cust-asf.ponee.io@cassandra.apache.org Mon Jan 15 19:14:39 2018 Return-Path: X-Original-To: archive-asf-public@eu.ponee.io Delivered-To: archive-asf-public@eu.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by mx-eu-01.ponee.io (Postfix) with ESMTP id A2177180657 for ; Mon, 15 Jan 2018 19:14:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 8F3B3160C31; Mon, 15 Jan 2018 18:14:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 601CA160C1C for ; Mon, 15 Jan 2018 19:14:38 +0100 (CET) Received: (qmail 94688 invoked by uid 500); 15 Jan 2018 18:14:36 -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 94678 invoked by uid 99); 15 Jan 2018 18:14:36 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jan 2018 18:14:36 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 05E94180633 for ; Mon, 15 Jan 2018 18:14:36 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.632 X-Spam-Level: ** X-Spam-Status: No, score=2.632 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=thelastpickle-com.20150623.gappssmtp.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id iMSIufqUpHsS for ; Mon, 15 Jan 2018 18:14:34 +0000 (UTC) Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 7A7075F47E for ; Mon, 15 Jan 2018 18:14:33 +0000 (UTC) Received: by mail-qt0-f172.google.com with SMTP id d4so15212131qtj.5 for ; Mon, 15 Jan 2018 10:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thelastpickle-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=oa1q7dtEoD+sBV/id+I0NEkYcHP4r4NL4qAvn1+8ns4=; b=jpfId2XrC+IP3n86tY/LgMLPs/nfW+0kJxvzbHLIdmMyKgz1ficye6/8SIBjpeNKjo UuEzB8/Sj6NArn2kLuMOTfi1t86H+nrf1D+bH7AI29gztMwN7AmsX7JZ/tc/427GFjhI SbxIZnQcco5WJOkuMEZK2IUU6RdXhh9O6hhvmfJe7ztGK9hwju0SiQs7R1ECpEraXO1s uXESFRnGiXeYKZLpyF0L/y2H5l9aQRdft/GBRPao35VXgnsoMeN62P6MyCilrdXD2dxS NLfCcXah+dRRBHwTy2KIOd3B2EnyvMQmBfBXNkM+dZ9yim6/VXCw18aKp4WmGIGu0WXO ub3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=oa1q7dtEoD+sBV/id+I0NEkYcHP4r4NL4qAvn1+8ns4=; b=XvV/eCfd0Zxd1d8RKHafxLyzIQY/9At6FDNuYljMMp832zDgcey6E17XkvyKpkoaWd aEpPCSv7DshuIg5La8IHeLVWP6cMPbYHKJ+7Yl6PqDtjhZT9NVTiWkyKWl0ExLTi554x Zb3uRkDAe/O1AVeLLv4M0opPT+tyebxJHEdzJO5e/IrEbuawV0ob6KgEiaYw6Rz6hUg3 4GHdNpF7OQUHxBa37/AauFqrGLBTayKlunXrroi4dBtU7ANNc5CUs1ZPitv9DsRetVik F6/0m9hSEnpOJ7hVP+WtIqOtZVZhoJZHTbXh02N0SlV8jK6ThGzJhEItyWmeGu6cAkD7 va3A== X-Gm-Message-State: AKwxytdVazWVjc5wVgaBJja7CAq5t+xV8uwwjYr6sk50UISdPf/EW2mM A5NPVTXHRNws+YFWtj2zhfTqvK5+O/1Qaao7HWh+9Hcc X-Google-Smtp-Source: ACJfBovlJoS+HXpCMnPCB4GfBpPkXZKRXKRn7V6Mt6qxrSyXc5Ol2HV3R7cdn2wutx7CRw4TFa14+c+xsxfdIb7uEDw= X-Received: by 10.200.2.141 with SMTP id p13mr8931585qtg.229.1516040072316; Mon, 15 Jan 2018 10:14:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Alexander Dejanovski Date: Mon, 15 Jan 2018 18:14:21 +0000 Message-ID: Subject: Re: vnodes: high availability To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary="f4030435cfb0f9dec00562d495ed" --f4030435cfb0f9dec00562d495ed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I was corrected off list that the odds of losing data when 2 nodes are down isn't dependent on the number of vnodes, but only on the number of nodes. The more vnodes, the smaller the chunks of data you may lose, and vice versa. I officially suck at statistics, as expected :) Le lun. 15 janv. 2018 =C3=A0 17:55, Alexander Dejanovski a =C3=A9crit : > Hi Kyrylo, > > the situation is a bit more nuanced than shown by the Datastax diagram, > which is fairly theoretical. > If you're using SimpleStrategy, there is no rack awareness. Since vnode > distribution is purely random, and the replica for a vnode will be placed > on the node that owns the next vnode in token order (yeah, that's not eas= y > to formulate), you end up with statistics only. > > I kinda suck at maths but I'm going to risk making a fool of myself :) > > The odds for one vnode to be replicated on another node are, in your case= , > 2/49 (out of 49 remaining nodes, 2 replicas need to be placed). > Given you have 256 vnodes, the odds for at least one vnode of a single > node to exist on another one is 256*(2/49) =3D 10.4% > Since the relationship is bi-directional (there are the same odds for nod= e > B to have a vnode replicated on node A than the opposite), that doubles t= he > odds of 2 nodes being both replica for at least one vnode : 20.8%. > > Having a smaller number of vnodes will decrease the odds, just as having > more nodes in the cluster. > (now once again, I hope my maths aren't fully wrong, I'm pretty rusty in > that area...) > > How many queries that will affect is a different question as it depends o= n > which partition currently exist and are queried in the unavailable token > ranges. > > Then you have rack awareness that comes with NetworkTopologyStrategy : > If the number of replicas (3 in your case) is proportional to the number > of racks, Cassandra will spread replicas in different ones. > In that situation, you can theoretically lose as many nodes as you want i= n > a single rack, you will still have two other replicas available to satisf= y > quorum in the remaining racks. > If you start losing nodes in different racks, we're back to doing maths > (but the odds will get slightly different). > > That makes maintenance predictable because you can shut down as many node= s > as you want in a single rack without losing QUORUM. > > Feel free to correct my numbers if I'm wrong. > > Cheers, > > > > > > On Mon, Jan 15, 2018 at 5:27 PM Kyrylo Lebediev > wrote: > >> Thanks, Rahul. >> >> But in your example, at the same time loss of Node3 and Node6 leads to >> loss of ranges N, C, J at consistency level QUORUM. >> >> >> As far as I understand in case vnodes > N_nodes_in_cluster and >> endpoint_snitch=3DSimpleSnitch, since: >> >> >> 1) "secondary" replicas are placed on two nodes 'next' to the node >> responsible for a range (in case of RF=3D3) >> >> 2) there are a lot of vnodes on each node >> 3) ranges are evenly distribusted between vnodes in case of SimpleSnitch= , >> >> >> we get all physical nodes (servers) having mutually adjacent token rage= s. >> Is it correct? >> >> At least in case of my real-world ~50-nodes cluster with nvodes=3D256, R= F=3D3 >> for this command: >> >> nodetool ring | grep '^' | awk '{print $1}' | uniq | grep -B2 >> -A2 '' | grep -v '' | grep -v '^--' | sort | >> uniq | wc -l >> >> returned number which equals to Nnodes -1, what means that I can't switc= h >> off 2 nodes at the same time w/o losing of some keyrange for CL=3DQUORUM= . >> >> >> Thanks, >> >> Kyrill >> ------------------------------ >> *From:* Rahul Neelakantan >> *Sent:* Monday, January 15, 2018 5:20:20 PM >> *To:* user@cassandra.apache.org >> *Subject:* Re: vnodes: high availability >> >> Not necessarily. It depends on how the token ranges for the vNodes are >> assigned to them. For example take a look at this diagram >> >> http://docs.datastax.com/en/archived/cassandra/2.0/cassandra/architectur= e/architectureDataDistributeDistribute_c.html >> >> In the vNode part of the diagram, you will see that Loss of Node 3 and >> Node 6, will still not have any effect on Token Range A. But yes if you >> lose two nodes that both have Token Range A assigned to them (Say Node 1 >> and Node 2), you will have unavailability with your specified configurat= ion. >> >> You can sort of circumvent this by using the DataStax Java Driver and >> having the client recognize a degraded cluster and operate temporarily i= n >> downgraded consistency mode >> >> >> http://docs.datastax.com/en/latest-java-driver-api/com/datastax/driver/c= ore/policies/DowngradingConsistencyRetryPolicy.html >> >> - Rahul >> >> On Mon, Jan 15, 2018 at 10:04 AM, Kyrylo Lebediev < >> Kyrylo_Lebediev@epam.com> wrote: >> >> Hi, >> >> >> Let's say we have a C* cluster with following parameters: >> >> - 50 nodes in the cluster >> >> - RF=3D3 >> >> - vnodes=3D256 per node >> >> - CL for some queries =3D QUORUM >> >> - endpoint_snitch =3D SimpleSnitch >> >> >> Is it correct that 2 any nodes down will cause unavailability of a >> keyrange at CL=3DQUORUM? >> >> >> Regards, >> >> Kyrill >> >> >> > > -- > ----------------- > Alexander Dejanovski > France > @alexanderdeja > > Consultant > Apache Cassandra Consulting > http://www.thelastpickle.com > --=20 ----------------- Alexander Dejanovski France @alexanderdeja Consultant Apache Cassandra Consulting http://www.thelastpickle.com --f4030435cfb0f9dec00562d495ed Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

I was corrected off list that the odds of losing data when 2= nodes are down isn't dependent on the number of vnodes, but only on th= e number of nodes.
The more vnodes, the smaller the chunks of data you may lose, and vice vers= a.

I officially suck at statistics, as expected :)


Le lun. 15 janv. 2018 =C3= =A0 17:55, Alexander Dejanovski <alex@thelastpickle.com> a =C3=A9crit=C2=A0:
Hi Kyrylo,

the situa= tion is a bit more nuanced than shown by the Datastax diagram, which is fai= rly theoretical.
If you're using SimpleStrategy, there is no = rack awareness. Since vnode distribution is purely random, and the replica = for a vnode will be placed on the node that owns the next vnode in token or= der (yeah, that's not easy to formulate), you end up with statistics on= ly.

I kinda suck at maths but I'm going to ris= k making a fool of myself :)

The odds for one vnod= e to be replicated on another node are, in your case, 2/49 (out of 49 remai= ning nodes, 2 replicas need to be placed).
Given you have 256 vno= des, the odds for at least one vnode of a single node to exist on another o= ne is 256*(2/49) =3D 10.4%
Since the relationship is bi-direction= al (there are the same odds for node B to have a vnode replicated on node A= than the opposite), that doubles the odds of 2 nodes being both replica fo= r at least one vnode : 20.8%.

Having a smaller num= ber of vnodes will decrease the odds, just as having more nodes in the clus= ter.
(now once again, I hope my maths aren't fully wrong, I&#= 39;m pretty rusty in that area...)

How many querie= s that will affect is a different question as it depends on which partition= currently exist and are queried in the unavailable token ranges.

Then you have rack awareness that comes wi= th NetworkTopologyStrategy :=C2=A0
If the= number of replicas (3 in your case) is proportional to the number of racks= , Cassandra will spread replicas in different ones.
In that situation, you can theoretically lose as many nodes as y= ou want in a single rack, you will still have two other replicas available = to satisfy quorum in the remaining racks.
If you start losing nodes in different racks, we're back to doing math= s (but the odds will get slightly different).

That makes maintenance predic= table because you can shut down as many nodes as you want in a single rack = without losing QUORUM.

<= div>Feel free to correct my numbers if I'm wrong.

Cheers,




On Mon, Jan 15, 2018 at 5:27 PM Kyrylo Lebediev <Kyrylo_Lebediev@epam.com> w= rote:

Thanks, Rahul.

But in your example, at the same = time loss of Node3 and Node6 leads to loss of ranges N, C, J at consistency= level QUORUM.


As far as I understand in case vn= odes > N_nodes_in_cluster and endpoint_snitch=3DSimpleSnitch, since:


1) "secondary" replicas are placed on two nodes 'next' to= the node responsible for a range (in case of RF=3D3)

2) there are a lot of vnodes on e= ach node
3) ranges are evenly distribusted between vnodes in case of SimpleSni= tch,


we get all physical nodes (server= s) having mutually adjacent=C2=A0 token rages.
Is it correct?

At least in case of my real-world ~50-nodes cluster with nvodes=3D256, RF= =3D3 for this command:

nodetool ring | grep '^<ip-prefix>' | awk '{print $= 1}' | uniq | grep -B2 -A2 '<ip_of_a_node>' | grep -v '= ;<ip_of_a_node>' | grep -v '^--' | sort | uniq | wc -l

returned number which equals to Nnodes -1, what means that I can't swit= ch off 2 nodes at the same time w/o losing of some keyrange for CL=3DQUORUM= .


Thanks,

Kyrill


From: Rahul Neelakantan <rahul@rahul.be>
Sent: Monday, January 15, 2018 5:20:20 PM
To: u= ser@cassandra.apache.org
Subject: Re: vnodes: high availability
=C2=A0
Not necessarily. It depends on how the token ranges for th= e vNodes are assigned to them. For example take a look at this diagram=C2= =A0

In the vNode part of the diagram, you will see that Loss of Node 3 and= Node 6, will still not have any effect on Token Range A. But yes if you lo= se two nodes that both have Token Range A assigned to them (Say Node 1 and = Node 2), you will have unavailability with your specified configuration.

You can sort of circumvent this by using the DataStax Java Driver and = having the client recognize a degraded cluster and operate temporarily in d= owngraded consistency mode


- Rahul

On M= on, Jan 15, 2018 at 10:04 AM, Kyrylo Lebediev <Kyrylo_Le= bediev@epam.com> wrote:

Hi,


Let's say we have=C2=A0a C* c= luster with following parameters:

=C2=A0- 50 nodes in the cluster

=C2=A0- RF=3D3

=C2=A0- vnodes=3D256 per node

=C2=A0- CL for some queries =3D Q= UORUM

=C2=A0- endpoint_snitch =3D Simpl= eSnitch


Is it correct that 2 any nodes do= wn=C2=A0will cause unavailability of a keyrange at CL=3DQUORUM?


Regards,

Kyrill




--
-----------------
Alexander Dejanovski
France=
@alexanderdeja

Consultant