Help on bucket quorums

Sean Cribbs sean at
Sat Jun 28 14:41:41 EDT 2014

On Sat, Jun 28, 2014 at 4:55 AM, Alex De la rosa < at>

> Hi there,
> Can somebody help me understand a bit better the bucket quorums? I will
> use the Python API to write code examples:
> Imagine we are building a web app like twitter, and we want fast read
> (although not need to be consistent) and safe writings, this R/W
> combination is appropriate?
> bucket = client.bucket('twits')
> bucket.r = 1
> bucket.w = 3
> # OR
> bucket.set_property('r', 1)
> bucket.set_property('w', 3)
> Which method is better to use? or are just exactly the same?
The pseudo-properties in the first example are exactly the same as the
set_property() calls in the second, just a convenience. Generally I
wouldn't recommend W=3 because it will tend to create false negatives under
heavy load, W=2 (the default) should be sufficient. Keep in mind that R=1
with notfound_ok = true (the default) can tend to result in false negative
responses as well.

> Imagine that in this new case, we want to focus on writing fast (normally
> we will write more "twits" than read them)... which would be the most
> appropriate/suggested quorums?
> Also, what's really the difference between "r" and "pr"? what is a
> "primary replica"?
Primaries are the replicas (nodes) that are the canonical owners the data,
but Riak will let you read and write even if they are not available. If
they are not available, fallback replicas (non-owner nodes) will take over
in their place. Setting PR or PW > 0 will result in failures if that many
primaries are not available (the node is down or partitioned from the node
that receives the request).

> If i set up bucket.w = 1, it will still do the 3 copies (n_val) in the
> background but will reply "true" once 1 copy is saved, right?
Yes. Keep in mind W is a fast-path response, i.e. "I received the request
to write", whereas DW is a "I saved the key to the storage engine". There
is no practical reason for DW ever to be 0, in fact I think it is
disallowed (or silently upgraded to 1).

> Thanks,
> Alex
> _______________________________________________
> riak-users mailing list
> riak-users at

Sean Cribbs <sean at>
Software Engineer
Basho Technologies, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list