Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 69795 invoked from network); 4 Apr 2010 23:53:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 4 Apr 2010 23:53:02 -0000 Received: (qmail 21110 invoked by uid 500); 4 Apr 2010 23:53:01 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 21084 invoked by uid 500); 4 Apr 2010 23:53:01 -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 21076 invoked by uid 99); 4 Apr 2010 23:53:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Apr 2010 23:53:01 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of prescod@gmail.com designates 74.125.83.44 as permitted sender) Received: from [74.125.83.44] (HELO mail-gw0-f44.google.com) (74.125.83.44) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 04 Apr 2010 23:52:56 +0000 Received: by gwj20 with SMTP id 20so738044gwj.31 for ; Sun, 04 Apr 2010 16:52:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:received:message-id :subject:to:content-type; bh=PR2z4AiNkqFU0/7YxtajQ/PlUuCpnwsEufbF25IdJkE=; b=BLmZIBC3/NMiZh0oWA9iVD7Q/GESMSWcuO8wgJ3H3sTxeSB5ZuzTcKiZhV8IMqu/mj YoMrdcoKMMng5Y+hM9esoopZD4lQKCTCOsQYe/2wYGPc0oTQL5TTCYFVYik9vF4GHTyv haJ1WNKlWyIU7y/htUfP5ZgACsM0nDgtAVOlg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:content-type; b=KVpsyJ1jZe3fAxnVLmCGekLaDUj6YeYKslOlpBWW2k7832GZL+4BYY/7qsmF7U45AS Bg4FC3KHJ226Vgrp56+QW56Kn5KL0O4YWyRwwnTRfZtkZ9mEui8zIwufvuY5C9X/2oV1 RgUUi5MHO1VseaXhxyi2x1EjAmSkmSdF7ZbSU= MIME-Version: 1.0 Sender: prescod@gmail.com Received: by 10.100.231.17 with HTTP; Sun, 4 Apr 2010 16:52:15 -0700 (PDT) In-Reply-To: References: From: Paul Prescod Date: Sun, 4 Apr 2010 16:52:15 -0700 X-Google-Sender-Auth: b47a850cce870745 Received: by 10.101.175.39 with SMTP id c39mr11264971anp.164.1270425155414; Sun, 04 Apr 2010 16:52:35 -0700 (PDT) Message-ID: Subject: Re: Memcached protocol? To: user@cassandra.apache.org Content-Type: text/plain; charset=UTF-8 On Sun, Apr 4, 2010 at 2:13 PM, Ryan Daum wrote: > > I'm the author/maintainer of jmemcached; I'd be willing to do this and it'd be quite easy to do, but Cassandra is missing a number of things which would make it so we could only support a subset of the memcache protocol. Yes, I had presumed that I would need to give up on the various functions that depended upon the previous value being available. The only one of these that I use in my applications is "add", to use Memcached as a hacky lock server. I'm willing to give that up though: there are many other components like Zookeeper and MySQL that can do locking. As soon as you have more than one Memcached server and a risk of partition, you already start to run into issues with depending on previous memcached values being "correct". So I'd propose you implement the subset for now. I have another idea about how to handle the longer term issue, though. My understanding of http://issues.apache.org/jira/browse/CASSANDRA-580 is that it will allow writes that are meant to be "merged" with other writes, like appends, increments and conditional sets. If I understand it correctly, you would register six "handlers" for increment, decrement, append text, prepend text, set-if-nonexistent, set-if-old-value-is-the-same. Vector clocks are slated to be implemented in Cassandra 0.7 In order to strictly implement Memcached behaviour (where the result is returned immediately), you'd need to do a READ just after your WRITE, to force the conflict engine to detect and resolve the conflict. A configuration file would probably allow the end-user to determine how slow/consistent this read should be: * http://wiki.apache.org/cassandra/API#ConsistencyLevel If you use memcached's clustering technique, rather than cassandra's, then all consistency levels would be equivalent. If there were a race condition in a multi-node situation (two writes before the nodes were consistent), probably both clients would have their writes rejected. They could either continue on that basis or retry with exponential back-off. > ... > > that said, if people see a use case for this, I would do it. I personally think that it would hit a nice 80/20 point, and once vector clocks are implemented it might be easy to get to 99% memcached compatibility. Paul Prescod