You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Omer van der Horst Jansen <om...@gmail.com> on 2010/05/24 21:19:19 UTC

get() with TTL update?

We have an application that stores session data in Cassandra. The
session data needs to be deleted after, say, one hour of inactivity. The
CASSANDRA-699 TTL update in 0.7 looks like it will work very well for
that.

However, we have a few scenarios where some session data will be
retrieved frequently, but not be updated at all. In that scenario we
need to make sure that the TTL gets refreshed on each read. I'm
currently handling this by rewriting the entire column with a new
timestamp and TTL.

That seems a bit inefficient. Sometimes the column data can be several
megabytes in size, and the only things in the column that need to be
updated are the timestamp and the TTL.

Is there currently a way to just update the timestamp and TTL? If not,
would it make sense to update the get method and the associated internal
plumbing to allow for an optional TTL parameter?

-Omer

Re: get() with TTL update?

Posted by Vick Khera <vi...@khera.org>.
On Mon, May 24, 2010 at 4:53 PM, Jonathan Ellis <jb...@gmail.com> wrote:
> (a) cassandra does not use update-in-place storage so doing the update
> as part of the get call isn't much of an efficiency gain

If you could issue an "update" type of command, any other data needed
for the new copy of the object could be copied internally to the
server, saving the round-trip of that data over the wire to the
client.  I know from my own experience using Postgres that this is a
big win for some operations.  In this particular case there are
several megabytes of data involved, so there would be a significant
efficiency gain, IMO.

Re: get() with TTL update?

Posted by Jonathan Ellis <jb...@gmail.com>.
(a) cassandra does not use update-in-place storage so doing the update
as part of the get call isn't much of an efficiency gain
(b) I don't think it's a common enough use case to warrant special treatment

On Mon, May 24, 2010 at 2:19 PM, Omer van der Horst Jansen
<om...@gmail.com> wrote:
> We have an application that stores session data in Cassandra. The
> session data needs to be deleted after, say, one hour of inactivity. The
> CASSANDRA-699 TTL update in 0.7 looks like it will work very well for
> that.
>
> However, we have a few scenarios where some session data will be
> retrieved frequently, but not be updated at all. In that scenario we
> need to make sure that the TTL gets refreshed on each read. I'm
> currently handling this by rewriting the entire column with a new
> timestamp and TTL.
>
> That seems a bit inefficient. Sometimes the column data can be several
> megabytes in size, and the only things in the column that need to be
> updated are the timestamp and the TTL.
>
> Is there currently a way to just update the timestamp and TTL? If not,
> would it make sense to update the get method and the associated internal
> plumbing to allow for an optional TTL parameter?
>
> -Omer
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of Riptano, the source for professional Cassandra support
http://riptano.com