From user-return-3917-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Mon Apr 05 17:19:38 2010 Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 45394 invoked from network); 5 Apr 2010 17:19:38 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 5 Apr 2010 17:19:38 -0000 Received: (qmail 66948 invoked by uid 500); 5 Apr 2010 17:19:37 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 66930 invoked by uid 500); 5 Apr 2010 17:19:37 -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 66922 invoked by uid 99); 5 Apr 2010 17:19:37 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 17:19:37 +0000 X-ASF-Spam-Status: No, hits=1.8 required=10.0 tests=AWL,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.223.185] (HELO mail-iw0-f185.google.com) (209.85.223.185) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Apr 2010 17:19:33 +0000 Received: by iwn15 with SMTP id 15so3190058iwn.7 for ; Mon, 05 Apr 2010 10:19:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.41.40 with HTTP; Mon, 5 Apr 2010 10:19:12 -0700 (PDT) In-Reply-To: References: <4BB98AC5.3040607@fourkitchens.com> <4BB99933.6030708@fourkitchens.com> Date: Mon, 5 Apr 2010 13:19:12 -0400 Received: by 10.231.182.79 with SMTP id cb15mr2801769ibb.71.1270487952181; Mon, 05 Apr 2010 10:19:12 -0700 (PDT) Message-ID: Subject: Re: Memcached protocol? From: Ryan Daum To: user@cassandra.apache.org, paul@prescod.net Content-Type: multipart/alternative; boundary=001485e5bfac14ca66048380878e --001485e5bfac14ca66048380878e Content-Type: text/plain; charset=ISO-8859-1 Are these applications using memcached for caching or for something else? I don't see the point in putting Cassandra in as a level 1 or 2 cache replacement? Especially given as it does not support any reasonable expiration policy that would be of use in those circumstances. Ryan On Mon, Apr 5, 2010 at 1:08 PM, Paul Prescod wrote: > On Mon, Apr 5, 2010 at 5:29 AM, Ryan Daum wrote: > > It seems pretty clear to me that the full memcached protocol is not > > appropriate for Cassandra. The question is whether some subset of it is > of > > any use to anybody. The only advantage I can see is that there are a > large > > number of clients out there that can speak it already; but any app that > is > > making extensive use of it is probably doing so in a way that would > preclude > > Cassandra+Jmemcached from being a "drop-in" addition. > > Here are a couple of example projects for info. > > Django: > > http://docs.djangoproject.com/en/dev/topics/cache/ > > It says of "increment/decrement": "incr()/decr() methods are not > guaranteed to be atomic. On those backends that support atomic > increment/decrement (most notably, the memcached backend), increment > and decrement operations will be atomic. However, if the backend > doesn't natively provide an increment/decrement operation, it will be > implemented using a two-step retrieve/update." > > add() is implied to be atomic. > > Django itself does use add() in exactly one line of code that I can > find. I believe it is just an optimization (don't bother saving this > object if it already exists) and is not semantically meaningful. In > fact, I don't believe that there is a code path to the add() call but > I'm really not investigating very deeply. > > Rails: > > > http://github.com/rails/rails/blob/master/actionpack/lib/action_controller/caching/actions.rb > > Here is the complete usage of the cache_store object in Rails. > > actionpack/lib/action_controller/caching/fragments.rb > 44: cache_store.write(key, content, options) > 55: result = cache_store.read(key, options) > 66: cache_store.exist?(key, options) > 94: cache_store.delete_matched(key, options) > 96: cache_store.delete(key, options) > > actionpack/lib/action_controller/caching.rb > 79: cache_store.fetch(ActiveSupport::Cache.expand_cache_key(key, > :controller), options, &block) > > Fetch is an abstraction on top of read. delete_matched is not > supported by the memcached plugin and not used by Rails. > > So as far as I can see, Rails only uses write, read, exist? and delete. > > It does expose more functions to the actual application, but the Rails > framework does not use them. Most of them (including > increment/decrement) are not even documented, and not supported with > most cache stores. > > * > http://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#M001029 > > I checked a few of my own apps. They use get/set/add/delete, but the > add is almost always used as an optimization. > > Paul Prescod > --001485e5bfac14ca66048380878e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Are these applications using memcached for caching or for something else?
I don't see the point in putting Cassandra in as a le= vel 1 or 2 cache replacement? Especially given as it does not support any r= easonable expiration policy that would be of use in those circumstances.
Ryan

On Mon, Apr 5, 2010 a= t 1:08 PM, Paul Prescod <prescod@gmail.com> wrote:
On Mon, Apr 5, 2010 at 5:29 AM, Ryan Daum <ryan@thimbleware.com> wrote:
> It seems pretty clear to me that the full memcached protocol is not > appropriate for Cassandra. The question is whether some subset of it i= s of
> any use to anybody. The only advantage I can see is that there are a l= arge
> number of clients out there that can speak it already; but any app tha= t is
> making extensive use of it is probably doing so in a way that would pr= eclude
> Cassandra+Jmemcached from being a "drop-in" addition.

Here are a couple of example projects for info.

Django:

http://docs.djangoproject.com/en/dev/topics/cache/

It says of "increment/decrement": "incr()/decr() methods are= not
guaranteed to be atomic. On those backends that support atomic
increment/decrement (most notably, the memcached backend), increment
and decrement operations will be atomic. However, if the backend
doesn't natively provide an increment/decrement operation, it will be implemented using a two-step retrieve/update."

add() is implied to be atomic.

Django itself does use add() in exactly one line of code that I can
find. I believe it is just an optimization (don't bother saving this object if it already exists) and is not semantically meaningful. In
fact, I don't believe that there is a code path to the add() call but I'm really not investigating very deeply.

Rails:

http://github.com/rails/ra= ils/blob/master/actionpack/lib/action_controller/caching/actions.rb

Here is the complete usage of the cache_store object in Rails.

actionpack/lib/action_controller/caching/fragments.rb
44: =A0 =A0 =A0 =A0 =A0cache_store.write(key, content, options)
55: =A0 =A0 =A0 =A0 =A0result =3D cache_store.read(key, options)
66: =A0 =A0 =A0 =A0 =A0cache_store.exist?(key, options)
94: =A0 =A0 =A0 =A0 =A0 =A0cache_store.delete_matched(key, options)
96: =A0 =A0 =A0 =A0 =A0 =A0cache_store.delete(key, options)

actionpack/lib/action_controller/caching.rb
79: =A0 =A0 =A0 =A0cache_store.fetch(ActiveSupport::Cache.expand_cache_key(= key,
:controller), options, &block)

Fetch is an abstraction on top of read. delete_matched is not
supported by the memcached plugin and not used by Rails.

So as far as I can see, Rails only uses write, read, exist? and delete.

It does expose more functions to the actual application, but the Rails
framework does not use them. Most of them (including
increment/decrement) are not even documented, and not supported with
most cache stores.

=A0* http://api.rubyonrails.org/classes/Active= Support/Cache/Store.html#M001029

I checked a few of my own apps. They use get/set/add/delete, but the
add is almost always used as an optimization.

=A0Paul Prescod

--001485e5bfac14ca66048380878e--