cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Vest Hansen <>
Subject Re: Incr/Decr Counters in Cassandra
Date Wed, 04 Nov 2009 22:05:35 GMT
Numeric addition and subtraction are commutable operations: they can
be performed in any order without conflict, which I think is a key
performance promise. So sending the computation to the data, instead
of the data to the computation is the way to go if at all possible, I

Not that your conflict resolution isn't useful, I just don't see this
particular case as a good example for it :)

On Wed, Nov 4, 2009 at 10:57 PM, Stu Hood <> wrote:
> This type of problem is one of the primary examples of something that should be handled
by pluggable/client-side conflict resolution in an eventually consistent system. Currently,
all conflicts in Cassandra are handled with "highest timestamp wins"
> Rather than attempting to add atomic operations, I think we should support one of the
following in the (near) future:
>  1) Client side resolution
>   * When two writes conflict (ex: two clients simultaneously read the counter at "2",
and then write it at "3"), the next client receives a callback with the old value and both
new values, and can then do application specific resolution (ex: both clients incremented
by "1", so use "4").
>  2) Pluggable resolution
>   * When two writes conflict, pluggable logic on the server side decides how to merge
the writes. You could implement the same algorithm used in the example above, but the code
would have to exist on the server side.
> Personally, I think (1) is the better approach, and for backwards compatibility in the
API, you could make the resolution optional.
> -----Original Message-----
> From: "Chris Goffinet" <>
> Sent: Wednesday, November 4, 2009 3:32pm
> To:
> Cc:
> Subject: Incr/Decr Counters in Cassandra
> Hey,
> At Digg we've been thinking about counters in Cassandra. In a lot of
> our use cases we need this type of support from a distributed storage
> system. Anyone else out there who has such needs as well? Zookeeper
> actually has such support and we might use that if we can't get the
> support in Cassandra.
> ---
> Chris Goffinet

Venlig hilsen / Kind regards,
Christian Vest Hansen.

View raw message