Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3425648A for ; Thu, 21 Apr 2011 01:08:56 +0000 (UTC) Received: (qmail 92356 invoked by uid 500); 21 Apr 2011 01:08:54 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 92330 invoked by uid 500); 21 Apr 2011 01:08:54 -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 92322 invoked by uid 99); 21 Apr 2011 01:08:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 01:08:54 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of tmarthinussen@gmail.com designates 74.125.82.172 as permitted sender) Received: from [74.125.82.172] (HELO mail-wy0-f172.google.com) (74.125.82.172) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2011 01:08:49 +0000 Received: by wyb29 with SMTP id 29so1178298wyb.31 for ; Wed, 20 Apr 2011 18:08:27 -0700 (PDT) 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=MvPJ0RvyErWHcaMAHfxawb/gd1Q4nUls/88qvus9oa8=; b=oUrl2EO7pp3kt3ip2Y2+US7624gQfTqaVzZrjrtadnfgSi6RW1bqiDNLO5xNpHt6PC FxirxIJPyZQGxmR96mZC/Y8fQoKj35/TmmzRGpSPHcALp/LeVSTOuy3BWaRmXMQD1/95 QAYy0QmpfSzjfGXzQup1oFVYE+BwW9pWvm4Vg= 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=gaVcc95OXz6MVgTyk8ew6mEUVbOCqDS1GTYTUq1AzKq9vF8W63izQQATp8duOBEqKs luReSL7NsN204X1J+Xc40SpZdg+dDXmvch21vQ1WLNpQsg6/2AHehfIfbD+mo4sNQyDT pvoMTKOVtNG7ScWf7cNnTKdOzcw1zKM1yKIWY= MIME-Version: 1.0 Received: by 10.216.255.201 with SMTP id j51mr7693919wes.94.1303348106589; Wed, 20 Apr 2011 18:08:26 -0700 (PDT) Received: by 10.217.3.202 with HTTP; Wed, 20 Apr 2011 18:08:26 -0700 (PDT) In-Reply-To: References: <137C359A7E324343B32BA7BFED81EF89@usnynyc1lpt0050> Date: Thu, 21 Apr 2011 10:08:26 +0900 Message-ID: Subject: Re: Multi-DC Deployment From: Terje Marthinussen To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=20cf301fb733e9767104a16360c4 --20cf301fb733e9767104a16360c4 Content-Type: text/plain; charset=ISO-8859-1 Assuming that you generally put an API on top of this, delivering to two or more systems then boils down to a message queue issue or some similar mechanism which handles secure delivery of messages. Maybe not trivial, but there are many products that can help you with this, and it is a lot easier to implement than a fully distributed storage system. Yes, ideally Cassandra will not distribute corruption, but the reason you pay up to have 2 fully redundant setups in 2 different datacenters is because we do not live in an ideal world. Anyone having tested Cassandra since 0.7.0 with any real data will be able to testify how well it can mess things up. This is not specific to Cassandra, in fact, I would argue thats this is in the blood of any distributed system. You want them to distribute after all and the tighter the coupling is between nodes, the better they distribute bad stuff as well as good stuff. There is a bigger risk for a complete failure with 2 tightly coupled redundant systems than with 2 almost completely isolated ones. The logic here is so simple it is really somewhat beyond discussion. There are a few other advantages of isolating the systems. Especially in terms of operation, 2 isolated systems would be much easier as you could relatively risk fee try out a new cassandra in one datacenter or upgrade one datacenter at a time if you needed major operational changes such as schema changes or other large changes to the data. I see the 2 copies in one datacenters + 1(or maybe 2) in another as a "low cost" middleway between 2 full N+2 (RF=3) systems in both data centers. That is, in a traditional design where you need 1 node for normal service, you would have 1 extra replicate for redundancy and one replica more (N+2 redundancy) so you can do maintenance and still be redundant. If I have redundancy across datacenters, I would probably still want 2 replicas to avoid network traffic between DCs in case of a node recovery, but N+2 may not be needed as my risk policy may find it acceptable to run one datacenters without redundancy for a time limited period for maintenance. That is, if my original requirement is 1 node, I could do with 3x the HW which is not all that much more than the 3x I need for one DC and a lot less than the 6x I need for 2 full N+2 systems. However, all of the above is really beyond the point of my original suggestion. Regardless of datacenters, redundancy and distribution of bad or good stuff, it would be good to have a way to return whatever data is there, but with a flag or similar stating that the consistency level was not met. Again, for a lot of services, it is fully acceptable, and a lot better, to return an almost complete (or maybe even complete, but no verified by quorum) result than no result at all. As far as I remember from the code, this just boils down to returning whatever you collected from the cluster and setting the proper flag or similar on the resultset rather than returning an error. Terje On Thu, Apr 21, 2011 at 5:01 AM, Adrian Cockcroft < adrian.cockcroft@gmail.com> wrote: > Hi Terje, > > If you feed data to two rings, you will get inconsistency drift as an > update to one succeeds and to the other fails from time to time. You > would have to build your own read repair. This all starts to look like > "I don't trust Cassandra code to work, so I will write my own buggy > one off versions of Cassandra functionality". I lean towards using > Cassandra features rather than rolling my own because there is a large > community testing, fixing and extending Cassandra, and making sure > that the algorithms are robust. Distributed systems are very hard to > get right, I trust lots of users and eyeballs on the code more than > even the best engineer working alone. > > Cassandra doesn't "replicate sstable corruptions". It detects corrupt > data and only replicates good data. Also data isn't replicated to > three identical nodes in the way you imply, it's replicated around the > ring. If you lose three nodes, you don't lose a whole node's worth of > data. We configure each replica to be in a different availability > zone so that we can lose a third of our nodes (a whole zone) and still > work. On a 300 node system with RF=3 and no zones, losing one or two > nodes you still have all your data, and can repair the loss quickly. > With three nodes dead at once you don't lose 1% of the data (3/300) I > think you lose 1/(300*300*300) of the data (someone check my math?). > > If you want to always get a result, then you use "read one", if you > want to get a highly available better quality result use local quorum. > That is a per-query option. > > Adrian > > On Tue, Apr 19, 2011 at 6:46 PM, Terje Marthinussen > wrote: > > If you have RF=3 in both datacenters, it could be discussed if there is a > > point to use the built in replication in Cassandra at all vs. feeding the > > data to both datacenters and get 2 100% isolated cassandra instances that > > cannot replicate sstable corruptions between each others.... > > My point is really a bit more general though. > > For a lot services (especially Internet based ones) 100% accuracy in > terms > > of results is not needed (or maybe even expected) > > While you want to serve a 100% correct result if you can (using quorum), > it > > is still much better to serve a partial result than no result at all. > > Lets say you have 300 nodes in your ring, one document manages to trigger > a > > bug in cassandra that brings down a node with all its replicas (3 nodes > > down) > > For many use cases, it would be much better to return the remaining 99% > of > > the data coming from the 297 working nodes than having a service which > > returns nothing at all. > > I would however like the frontend to realize that this is an incomplete > > result so it is possible for it to react accordingly as well as be part > of > > monitoring of the cassandra ring. > > Regards, > > Terje > > > > On Tue, Apr 19, 2011 at 6:06 PM, Adrian Cockcroft > > wrote: > >> > >> If you want to use local quorum for a distributed setup, it doesn't > >> make sense to have less than RF=3 local and remote. Three copies at > >> both ends will give you high availability. Only one copy of the data > >> is sent over the wide area link (with recent versions). > >> > >> There is no need to use mirrored or RAID5 disk in each node in this > >> case, since you are using RAIN (N for nodes) to protect your data. So > >> the extra disk space to hold three copies at each end shouldn't be a > >> big deal. Netflix is using striped internal disks on EC2 nodes for > >> this. > >> > >> Adrian > >> > >> On Mon, Apr 18, 2011 at 11:16 PM, Terje Marthinussen > >> wrote: > >> > Hum... > >> > Seems like it could be an idea in a case like this with a mode where > >> > result > >> > is always returned (if possible), but where a flay saying if the > >> > consistency > >> > level was met, or to what level it was met (number of nodes answering > >> > for > >> > instance).? > >> > Terje > >> > > >> > On Tue, Apr 19, 2011 at 1:13 AM, Jonathan Ellis > >> > wrote: > >> >> > >> >> They will timeout until failure detector realizes the DC1 nodes are > >> >> down (~10 seconds). After that they will immediately return > >> >> UnavailableException until DC1 comes back up. > >> >> > >> >> On Mon, Apr 18, 2011 at 10:43 AM, Baskar Duraikannu > >> >> wrote: > >> >> > We are planning to deploy Cassandra on two data centers. Let us > say > >> >> > that > >> >> > we went with three replicas with 2 being in one data center and > last > >> >> > replica > >> >> > in 2nd Data center. > >> >> > > >> >> > What will happen to Quorum Reads and Writes when DC1 goes down (2 > of > >> >> > 3 > >> >> > replicas are unreachable)? Will they timeout? > >> >> > > >> >> > > >> >> > Regards, > >> >> > Baskar > >> >> > >> >> > >> >> > >> >> -- > >> >> Jonathan Ellis > >> >> Project Chair, Apache Cassandra > >> >> co-founder of DataStax, the source for professional Cassandra support > >> >> http://www.datastax.com > >> > > >> > > > > > > --20cf301fb733e9767104a16360c4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Assuming that you generally put an API on top of this, delivering to two or= more systems then boils down to a message queue issue or some similar mech= anism which handles secure delivery of messages. Maybe not trivial, but the= re are many products that can help you with this, and it is a lot easier to= implement than a fully distributed storage system.

Yes, ideally Cassandra will not distribute corruption, but t= he reason you pay up to have 2 fully redundant setups in 2 different datace= nters is because we do not live in an ideal world. Anyone having tested Cas= sandra since 0.7.0 with any real data will be able to testify how well it c= an mess things up.

This is not specific to Cassandra, in fact, I would arg= ue thats this is in the blood of any distributed system. You want them to d= istribute after all and the=A0tighter=A0the coupling is between nodes, the = better they distribute bad stuff as well as good stuff.

There is a bigger risk for a complete failure with 2=A0= tightly=A0coupled redundant systems than with 2 almost completely isolated = ones. The logic here is so simple it is really somewhat beyond discussion.= =A0

There are a few other advantages of isolating the syste= ms. Especially in terms of operation, 2 isolated systems would be much easi= er as you could relatively risk fee try out a new cassandra in one datacent= er or upgrade one datacenter at a time if you needed major operational chan= ges such as schema changes or other large changes to the data.

I see the 2 copies in one datacenters + 1(or maybe 2) i= n another as a "low cost" middleway between 2 full N+2 (RF=3D3) s= ystems in both data centers.

That is, in a traditi= onal design where you need 1 node for normal service, you would have 1 extr= a replicate for redundancy and one replica more (N+2 redundancy) so you can= do maintenance and still be redundant.=A0

If I have redundancy across datacenters, I would probab= ly still want 2 replicas to avoid network traffic between DCs in case of a = node recovery, but N+2 may not be needed as my risk policy may find it acce= ptable to run one datacenters without redundancy for a time limited period = for maintenance.

That is, if my original requirement is 1 node, I could = do with 3x the HW which is not all that much more than the 3x I need for on= e DC and a lot less than the 6x I need for 2 full N+2 systems.

However, all of the above is really beyond the point of my o= riginal suggestion.

Regardless of datacenters, red= undancy and distribution of bad or good stuff, it would be good to have a w= ay to return whatever data is there, but with a flag or similar stating tha= t the consistency level was not met.

Again, for a lot of services, it is fully acceptable, a= nd a lot better, to return an almost complete (or maybe even complete, but = no verified by quorum) result than no result at all.

As far as I remember from the code, this just boils down to returning = whatever you collected from the cluster and setting the proper flag or simi= lar on the resultset rather than returning an error.

Terje

On Thu, Apr 21, 2011 at= 5:01 AM, Adrian Cockcroft <adrian.cockcroft@gmail.com> wrote:
Hi Terje,

If you feed data to two rings, you will get inconsistency drift as an
update to one succeeds and to the other fails from time to time. You
would have to build your own read repair. This all starts to look like
"I don't trust Cassandra code to work, so I will write my own bugg= y
one off versions of Cassandra functionality". I lean towards using
Cassandra features rather than rolling my own because there is a large
community testing, fixing and extending Cassandra, and making sure
that the algorithms are robust. Distributed systems are very hard to
get right, I trust lots of users and eyeballs on the code more than
even the best engineer working alone.

Cassandra doesn't "replicate sstable corruptions". It detects= corrupt
data and only replicates good data. Also data isn't replicated to
three identical nodes in the way you imply, it's replicated around the<= br> ring. If you lose three nodes, you don't lose a whole node's worth = of
data. =A0We configure each replica to be in a different availability
zone so that we can lose a third of our nodes (a whole zone) and still
work. On a 300 node system with RF=3D3 and no zones, losing one or two
nodes you still have all your data, and can repair the loss quickly.
With three nodes dead at once you don't lose 1% of the data (3/300) I think you lose 1/(300*300*300) of the data (someone check my math?).

If you want to always get a result, then you use "read one", if y= ou
want to get a highly available better quality result use local quorum.
That is a per-query option.

Adrian

On Tue, Apr 19, 2011 at 6:46 PM, Terje Marthinussen
<tmarthinussen@gmail.com> wrote:
> If you have RF=3D3 in both datacenters, it could be discussed if there= is a
> point to use the built in replication in Cassandra at all vs. feeding = the
> data to both datacenters and get 2 100% isolated cassandra instances t= hat
> cannot replicate sstable corruptions between each others....
> My point is really a bit more general though.
> For a lot services (especially Internet based ones) 100% accuracy in t= erms
> of results is not needed (or maybe even expected)
> While you want to serve a 100% correct result if you can (using quorum= ), it
> is still much better to serve a partial result than no result at all.<= br> > Lets say you have 300 nodes in your ring, one document manages to trig= ger a
> bug in cassandra that brings down a node with all its replicas (3 node= s
> down)
> For many use cases, it would be much better to return the remaining 99= % of
> the data coming from the 297 working nodes than having a service which=
> returns nothing at all.
> I would however like the frontend to realize that this is an incomplet= e
> result so it is possible for it to react accordingly as well as be par= t of
> monitoring of the cassandra ring.
> Regards,
> Terje
>
> On Tue, Apr 19, 2011 at 6:06 PM, Adrian Cockcroft
> <adrian.cockcroft@gma= il.com> wrote:
>>
>> If you want to use local quorum for a distributed setup, it doesn&= #39;t
>> make sense to have less than RF=3D3 local and remote. Three copies= at
>> both ends will give you high availability. Only one copy of the da= ta
>> is sent over the wide area link (with recent versions).
>>
>> There is no need to use mirrored or RAID5 disk in each node in thi= s
>> case, since you are using RAIN (N for nodes) to protect your data.= So
>> the extra disk space to hold three copies at each end shouldn'= t be a
>> big deal. Netflix is using striped internal disks on EC2 nodes for=
>> this.
>>
>> Adrian
>>
>> On Mon, Apr 18, 2011 at 11:16 PM, Terje Marthinussen
>> <tmarthinussen@gmail= .com> wrote:
>> > Hum...
>> > Seems like it could be an idea in a case like this with a mod= e where
>> > result
>> > is always returned (if possible), but where a flay saying if = the
>> > consistency
>> > level was met, or to what level it was met (number of nodes a= nswering
>> > for
>> > instance).?
>> > Terje
>> >
>> > On Tue, Apr 19, 2011 at 1:13 AM, Jonathan Ellis <jbellis@gmail.com>
>> > wrote:
>> >>
>> >> They will timeout until failure detector realizes the DC1= nodes are
>> >> down (~10 seconds). After that they will immediately retu= rn
>> >> UnavailableException until DC1 comes back up.
>> >>
>> >> On Mon, Apr 18, 2011 at 10:43 AM, Baskar Duraikannu
>> >> <bas= kar.duraikannu.db@gmail.com> wrote:
>> >> > We are planning to deploy Cassandra on two data cent= ers.=A0=A0 Let us say
>> >> > that
>> >> > we went with three replicas with 2 being in one data= center and last
>> >> > replica
>> >> > in 2nd Data center.
>> >> >
>> >> > What will happen to Quorum Reads and Writes when DC1= goes down (2 of
>> >> > 3
>> >> > replicas are unreachable)?=A0 Will they timeout?
>> >> >
>> >> >
>> >> > Regards,
>> >> > Baskar
>> >>
>> >>
>> >>
>> >> --
>> >> Jonathan Ellis
>> >> Project Chair, Apache Cassandra
>> >> co-founder of DataStax, the source for professional Cassa= ndra support
>> >> htt= p://www.datastax.com
>> >
>> >
>
>

--20cf301fb733e9767104a16360c4--