Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 45809 invoked from network); 5 Apr 2010 23:49:18 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Apr 2010 23:49:18 -0000 Received: (qmail 5758 invoked by uid 500); 5 Apr 2010 23:49:17 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 5735 invoked by uid 500); 5 Apr 2010 23:49:17 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 5727 invoked by uid 99); 5 Apr 2010 23:49:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 23:49:17 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tsaloranta@gmail.com designates 209.85.160.44 as permitted sender) Received: from [209.85.160.44] (HELO mail-pw0-f44.google.com) (209.85.160.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 23:49:11 +0000 Received: by pwj2 with SMTP id 2so2051277pwj.31 for ; Mon, 05 Apr 2010 16:48:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:received:message-id:subject:from:to:content-type; bh=9WCpf0Ytagkv5vJsidAF+boRZN7ZDCr0d+7zQc3dTis=; b=CSjN3S5IuDXolBEepTVWdFVNkOOtDkllHinc2JsRJaZrxnWaVlvV9guVCcSKfkpmFz A6Pyk9cZhP221Q4DNJ659EiP+5kVW1v2UnV5qKh7jQ3mIemzn2EqkkUVabO4NjgqvnoK IuXCe2icecYjzQjEIlud0DguSiwMDxGFspxbQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ICxMbkUkOZrCeCwDnapmPMpZrJgAePSd8cMgWi16CdynjtN7+pGmdF4ARPKMj6anhH b76WbS7hvTpOQxzlp2crNXudNnhMFnNUXtyKhhs9BE/dpYyoePPtX54LsopLJBi5lm1V 8hrcug41Z1rlxBJyRWCMETSTqq77CZZsDvJHY= MIME-Version: 1.0 Received: by 10.140.226.1 with HTTP; Mon, 5 Apr 2010 16:48:50 -0700 (PDT) In-Reply-To: References: <4BB98AC5.3040607@fourkitchens.com> <4BB99933.6030708@fourkitchens.com> Date: Mon, 5 Apr 2010 16:48:50 -0700 Received: by 10.141.188.26 with SMTP id q26mr4571837rvp.150.1270511330508; Mon, 05 Apr 2010 16:48:50 -0700 (PDT) Message-ID: Subject: Re: Memcached protocol? From: Tatu Saloranta To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Apr 5, 2010 at 1:46 PM, Paul Prescod wrote: > On Mon, Apr 5, 2010 at 1:35 PM, Mike Malone wrote: >>> That's useful information Mike. I am a bit curious about what the most >>> common use cases are for atomic increment/decrement. I'm familiar with >>> atomic add as a sort of locking mechanism. >> >> They're useful for caching denormalized counts of things. Especially things >> that change rapidly. Instead of invalidating the counter whenever an event >> occurs that would incr/decr the counter, you can incr/decr the cached count >> too. > > Do you think that a future cassandra increment/decrement would be > incompatible with those use cases? > > It seems to me that in that use case, an eventually consistent counter > is as useful as any other eventually consistent datum. In other words, > there is no problem incrementing from 12 to 13 and getting back 15 as > the return value (due to coinciding increments). 15 is the current > correct value. It's arguably more correct then a memcached value which > other processes are trying to update but cannot because of locking. > Benjamin seemed to think that there were applications that depended on > the result always being 13. I would think that there is also possibility of losing some increments, or perhaps getting duplicate increments? It is not just isolation but also correctness that is hard to maintain but correctness also. This can be more easily worked around in cases where there is additional data that can be used to resolve potentially ambiguous changes (like inferring which of shopping cart additions are real, which duplicates). With more work I am sure it is possible to get things mostly working, it's just question of cost/benefit for specific use cases. I think distributed counters are useful, but difficulty depends on what are expected levels of concurrency/correctness/isolation. There are many use cases where "about right" (or at least only losing additions, or only getting extra ones) is enough. For example, when calculating charges for usage, it is probably ok to lose some usage charges, but not add bogus ones. If mostly consistent result can be achieved cheaply, there is no point in implementing more complex system to get minor increment (prevent loss of, say, 2% of uncounted-for requests). -+ Tatu +-