You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Eldad Yamin <el...@gmail.com> on 2011/08/02 23:32:58 UTC

cassandra consistency level

Is consistency level "All" for write actually grenty that my data is updated
in all of my node?
is it apply to read actions as-well?

I've read it on the wiki, I just want to make sure.
Thanks!

Re: cassandra consistency level

Posted by aaron morton <aa...@thelastpickle.com>.
> In other words, if one of the nodes is down - the write (or read) will fail.

No.

Cassandra will always try to get a write distributed to RF nodes. The Consistency Level is how many replicas you want to be written before you accept the request was a success. e.g. with RF 3 and QUORUM you are saying wait until at least 2 replicas have completed. So you can have one node down.  If the write is not replicated during the request it may eventually get there via the Read Repair, Hinted Handoff or Repair processes. 

If you always use QUORUM for read and write you will get consistent behaviour, see http://wiki.apache.org/cassandra/ArchitectureOverview I would recommend using QUORUM until you can find a good reason to use something else (performance is not a good reason). 

For you model, it sounds like you should handle each user action as a separate column. This has to do with concurrency around the update, not the consistency model. Have a look at the data modelling slides here http://www.datastax.com/events/cassandrasf2011/presentations


Hope that helps.

 
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 3 Aug 2011, at 16:59, Eldad Yamin wrote:

> So what you're saying is that no matter what consistency level I'm using, the data will be written to all CF nodes right away, the consistency level is just for making sure that all CF nodes are UP and all data is written.
> In other words, if one of the nodes is down - the write (or read) will fail.
> 
> I'm asking that because I'm a bit worried with consistency, for example:
> Every action that my client is doing is stored in a CF.x in a specific column by his user_id.
> I'm doing that by de-serializing the data that already found in the column, adding new data (the action), serializing and storing the data.
> so I'm worrying that some of the user actions will "drop" due low-consistency when there are lots of changes to a specific column in a sort period of time.
> I know that I can solve this situation in a different way by storing each action in a new column etc... but this is just an example that explain my question in a simple way.
> 
> Thanks!
> 
> 
> 
> On Wed, Aug 3, 2011 at 3:21 AM, aaron morton <aa...@thelastpickle.com> wrote:
> Not sure I understand your question exactly, but will take a shot…
> 
> Writes are sent to every UP node, the consistency level is how many nodes we require to complete before we say the request completed successfully. So we also make sure that CL nodes are UP before we start the request. If you run CL ALL then Replication Factor nodes must be up for each key you are writing.
> 
> With the exception of CL ONE reads are also sent to all UP replicas.
> 
> Hope that helps.
> 
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
> 
> On 3 Aug 2011, at 09:32, Eldad Yamin wrote:
> 
> > Is consistency level "All" for write actually grenty that my data is updated in all of my node?
> > is it apply to read actions as-well?
> >
> > I've read it on the wiki, I just want to make sure.
> > Thanks!
> 
> 


Re: cassandra consistency level

Posted by Eldad Yamin <el...@gmail.com>.
So what you're saying is that no matter what consistency level I'm using,
the data will be written to all CF nodes right away, the consistency level
is just for making sure that all CF nodes are UP and all data is written.
In other words, if one of the nodes is down - the write (or read) will fail.

I'm asking that because I'm a bit worried with consistency, for example:
Every action that my client is doing is stored in a CF.x in a specific
column by his user_id.
I'm doing that by de-serializing the data that already found in the column,
adding new data (the action), serializing and storing the data.
so I'm worrying that some of the user actions will "drop" due
low-consistency when there are lots of changes to a specific column in a
sort period of time.
I know that I can solve this situation in a different way by storing each
action in a new column etc... but this is just an example that explain my
question in a simple way.

Thanks!



On Wed, Aug 3, 2011 at 3:21 AM, aaron morton <aa...@thelastpickle.com>wrote:

> Not sure I understand your question exactly, but will take a shot…
>
> Writes are sent to every UP node, the consistency level is how many nodes
> we require to complete before we say the request completed successfully. So
> we also make sure that CL nodes are UP before we start the request. If you
> run CL ALL then Replication Factor nodes must be up for each key you are
> writing.
>
> With the exception of CL ONE reads are also sent to all UP replicas.
>
> Hope that helps.
>
> -----------------
> Aaron Morton
> Freelance Cassandra Developer
> @aaronmorton
> http://www.thelastpickle.com
>
> On 3 Aug 2011, at 09:32, Eldad Yamin wrote:
>
> > Is consistency level "All" for write actually grenty that my data is
> updated in all of my node?
> > is it apply to read actions as-well?
> >
> > I've read it on the wiki, I just want to make sure.
> > Thanks!
>
>

Re: cassandra consistency level

Posted by aaron morton <aa...@thelastpickle.com>.
Not sure I understand your question exactly, but will take a shot…

Writes are sent to every UP node, the consistency level is how many nodes we require to complete before we say the request completed successfully. So we also make sure that CL nodes are UP before we start the request. If you run CL ALL then Replication Factor nodes must be up for each key you are writing. 

With the exception of CL ONE reads are also sent to all UP replicas. 

Hope that helps. 
 
-----------------
Aaron Morton
Freelance Cassandra Developer
@aaronmorton
http://www.thelastpickle.com

On 3 Aug 2011, at 09:32, Eldad Yamin wrote:

> Is consistency level "All" for write actually grenty that my data is updated in all of my node?
> is it apply to read actions as-well?
> 
> I've read it on the wiki, I just want to make sure.
> Thanks!