You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by mcasandra <mo...@gmail.com> on 2011/02/18 21:48:23 UTC

Async write

I am still trying to understand how writes work. Is there any concept of sync
and async writes? For eg:

If I want to have W=2 but 1 write as sync and the 2nd as async. 

Or say I want to have W=3 with networktopology with DC1 getting 1 sync write
+ 1 async write and DC2 always getting async write.


-- 
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041440.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.

Re: Async write

Posted by A J <s5...@gmail.com>.
W always stands for number of sync writes. N-W is the number of async writes.
Note, N decides number of replicas. W only decides out of those N
replicas, how many should be written synchronously before returning
success of write to client. All writes always happen to a total of N
nodes (W right away and the rest later)
The higher the value of W the more sync writes and so more latency.

I might be wrong, but I think you cannot decide which of the N nodes
will get the sync write. On a write-by-write basis, I think Cassandra
needs the flexibility to decide on several parameters which W out of N
nodes would it write synchronously.



On Fri, Feb 18, 2011 at 3:48 PM, mcasandra <mo...@gmail.com> wrote:
>
> I am still trying to understand how writes work. Is there any concept of sync
> and async writes? For eg:
>
> If I want to have W=2 but 1 write as sync and the 2nd as async.
>
> Or say I want to have W=3 with networktopology with DC1 getting 1 sync write
> + 1 async write and DC2 always getting async write.
>
>
> --
> View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041440.html
> Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.
>

Re: Async write

Posted by Anthony John <ch...@gmail.com>.
This is transparent!

Essentially - when enough writes are acknowledged to meet the desired
Consistency Level - it returns.

On Fri, Feb 18, 2011 at 2:48 PM, mcasandra <mo...@gmail.com> wrote:

>
> I am still trying to understand how writes work. Is there any concept of
> sync
> and async writes? For eg:
>
> If I want to have W=2 but 1 write as sync and the 2nd as async.
>
> Or say I want to have W=3 with networktopology with DC1 getting 1 sync
> write
> + 1 async write and DC2 always getting async write.
>
>
> --
> View this message in context:
> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041440.html
> Sent from the cassandra-user@incubator.apache.org mailing list archive at
> Nabble.com.
>

Re: Async write

Posted by Aaron Morton <aa...@thelastpickle.com>.
Sorry, was typing faster than my brain was working. 

I was trying to say at the higher level the request would block for the write operations in other DC's to complete. As you say.

That was the ticket I was thinking of. 

Thanks
Aaron
 

On 21 Feb, 2011,at 01:19 PM, Jonathan Ellis <jb...@gmail.com> wrote:

On Sun, Feb 20, 2011 at 1:36 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
> > On 19/02/2011, at 10:24 AM, Anthony John <ch...@gmail.com> wrote:
> >
> > Fact as i understand them:-
> > - A write call to db triggers a number of async writes to all nodes where
> > the particular write should be recorded (and the nodes are up per Gossip and
> > so on)
> > - Once desired CL number of writes acknowledge - the call returns
>
> AFAIK the write across the dc is sync as well.

Anthony was correct: writes are asynchronous at the lowest level, and
then we pick which to block for based on CL

> I think there I'd a ticket out there to make them asnc, take a look at Jira.

You may be thinking of
https://issues.apache.org/jira/browse/CASSANDRA-1530, which was
completed for 0.7.1 but didn't change a/sync behavior.

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: Async write

Posted by Jonathan Ellis <jb...@gmail.com>.
On Sun, Feb 20, 2011 at 1:36 PM, Aaron Morton <aa...@thelastpickle.com> wrote:
> > On 19/02/2011, at 10:24 AM, Anthony John <ch...@gmail.com> wrote:
> >
> > Fact as i understand them:-
> > - A write call to db triggers a number of async writes to all nodes where
> > the particular write should be recorded (and the nodes are up per Gossip and
> > so on)
> > - Once desired CL number of writes acknowledge - the call returns
>
> AFAIK the write across the dc is sync as well.

Anthony was correct: writes are asynchronous at the lowest level, and
then we pick which to block for based on CL.

> I think there I'd a ticket out there to make them asnc, take a look at Jira.

You may be thinking of
https://issues.apache.org/jira/browse/CASSANDRA-1530, which was
completed for 0.7.1 but didn't change a/sync behavior.

-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Re: Async write

Posted by Aaron Morton <aa...@thelastpickle.com>.
AFAIK the write across the dc is sync as well. I think there I'd a ticket out there to make them asnc, take a look at Jira.

Aaron

On 19/02/2011, at 10:24 AM, Anthony John <ch...@gmail.com> wrote:

> Fact as i understand them:-
> - A write call to db triggers a number of async writes to all nodes where the particular write should be recorded (and the nodes are up per Gossip and so on)
> - Once desired CL number of writes acknowledge - the call returns
> 
> So your issue is moot. That is what is happening under the covers!
> 
> 
> On Fri, Feb 18, 2011 at 3:08 PM, mcasandra <mo...@gmail.com> wrote:
> 
> So does it mean there is no way to say use sync + async ? I am thinking if I
> have to write accross data center and doing it synchronuosly is going to be
> very slow and will be bad for clients to have to wait. What are my options
> or alternatives?
> 
> Use N=3 and W=2? And the 3rd one (assuming will be async) will be in other
> DC? How do I set it up or possible to setup?
> --
> View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041479.html
> Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.
> 

Re: Async write

Posted by Anthony John <ch...@gmail.com>.
Fact as i understand them:-
- A write call to db triggers a number of async writes to all nodes where
the particular write should be recorded (and the nodes are up per Gossip and
so on)
- Once desired CL number of writes acknowledge - the call returns

So your issue is moot. That is what is happening under the covers!


On Fri, Feb 18, 2011 at 3:08 PM, mcasandra <mo...@gmail.com> wrote:

>
> So does it mean there is no way to say use sync + async ? I am thinking if
> I
> have to write accross data center and doing it synchronuosly is going to be
> very slow and will be bad for clients to have to wait. What are my options
> or alternatives?
>
> Use N=3 and W=2? And the 3rd one (assuming will be async) will be in other
> DC? How do I set it up or possible to setup?
> --
> View this message in context:
> http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041479.html
> Sent from the cassandra-user@incubator.apache.org mailing list archive at
> Nabble.com.
>

Re: Async write

Posted by mcasandra <mo...@gmail.com>.
So does it mean there is no way to say use sync + async ? I am thinking if I
have to write accross data center and doing it synchronuosly is going to be
very slow and will be bad for clients to have to wait. What are my options
or alternatives?

Use N=3 and W=2? And the 3rd one (assuming will be async) will be in other
DC? How do I set it up or possible to setup?
-- 
View this message in context: http://cassandra-user-incubator-apache-org.3065146.n2.nabble.com/Async-write-tp6041440p6041479.html
Sent from the cassandra-user@incubator.apache.org mailing list archive at Nabble.com.