Read Before Writes on Distributed Counters

Russell Brown russell.brown at
Thu Oct 17 10:21:51 EDT 2013

Hi Wes,

The client application does not need to perform a read before a write, the riak server must read from disk before updating the counter. Or at least it must with our current implementation.

What PRs did you have in mind? I'm curious.

Oh, it looks like Sam beat me to it…to elaborate on his "not idempotent" line, that means when riak tells you "error" for some counter increment, it may only be a partial failure, and re-running the operation may lead to over counting.



On 17 Oct 2013, at 16:03, Weston Jossey <weston.jossey at> wrote:

> In the context of using distributed counters (introduced in 1.4), is it strictly necessary to perform a read prior to issue a write for a given key?  A la, if I want to blindly increment a value by 1, regardless of what its current value is, is it sufficient to issue the write without previously having read the object?
> I ask because looking at some of the implementations for counters in the open source community, it's common to perform a read before a write, which impacts performance ceilings on clusters with high volume reads / writes.  I want to verify before issuing some PRs that this is in fact safe behavior.
> Thank you!
> -Wes Jossey
> _______________________________________________
> riak-users mailing list
> riak-users at

More information about the riak-users mailing list