Return-Path: Delivered-To: apmail-cassandra-user-archive@www.apache.org Received: (qmail 63273 invoked from network); 15 Feb 2011 19:50:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Feb 2011 19:50:58 -0000 Received: (qmail 46463 invoked by uid 500); 15 Feb 2011 19:50:56 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 46361 invoked by uid 500); 15 Feb 2011 19:50:53 -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 46353 invoked by uid 99); 15 Feb 2011 19:50:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Feb 2011 19:50:53 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a44.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Feb 2011 19:50:45 +0000 Received: from homiemail-a44.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a44.g.dreamhost.com (Postfix) with ESMTP id AED5F118059 for ; Tue, 15 Feb 2011 11:50:22 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=thelastpickle.com; h=subject :references:from:content-type:in-reply-to:message-id:date:to :content-transfer-encoding:mime-version; q=dns; s= thelastpickle.com; b=jgfGPrKqXAxF380O6JIQEeqBLQrY7NzYnJajFdt1Vqb nm19JKcASKqUUCdDUPp4EOd0IqQPVBQs0m27b4VANJfhi6u4Y9jqbgJsCk1m6e49 555PI/bd3WW+0CvuVrfZjuHkWXcYJgGUOiA545m3bESOFp3YSXZKzb6JcGoTwS1A = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h= subject:references:from:content-type:in-reply-to:message-id:date :to:content-transfer-encoding:mime-version; s=thelastpickle.com; bh=hHmGlNJlWMzbgk/AbjxvlnmKy7E=; b=YxSgd6/8szlcgX3mZPuPMCwQiRgl Ou1f3w7tW+DcYlcnldz1OKVpXUq8TD7zTLlw+Z2ktfh+IR9PIeKB/yUBFzBmkxU6 z8mW4IVFVVpnTjjFWHSXyflaZkp3x80VO0InsjRC/5aTcIyu0kO+ajfyQGO9Pg0W ScvVeVI5qQvPapg= Received: from [115.189.202.207] (unknown [115.189.202.207]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a44.g.dreamhost.com (Postfix) with ESMTPSA id B114B118057 for ; Tue, 15 Feb 2011 11:50:20 -0800 (PST) Subject: Re: online chat scenario References: From: Aaron Morton Content-Type: multipart/alternative; boundary=Apple-Mail-3--482842421 X-Mailer: iPad Mail (8C148) In-Reply-To: Message-Id: <9A362ABF-A7D8-4B94-A44D-0833E9F692D1@thelastpickle.com> Date: Wed, 16 Feb 2011 08:50:11 +1300 To: "user@cassandra.apache.org" Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (iPad Mail 8C148) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-3--482842421 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 There was a by here last year who did something similar and did a nice write= up. Cannot find it right now, some googleing may help. Aaron On 16/02/2011, at 2:56 AM, Victor Kabdebon wrote= : > Hello Sasha. >=20 > In this sort of real time application the way you insert (QUORUM, ONE, etc= ..) and the way you retrieve is extremely important because your data may n= ot have had the time to propagate to all your nodes. Be sure to use adequate= policies to do that : insert to a certain number of nodes but don't sacrifi= ce to much time doing that to keep the real time component. > Here is a presentation of how the chat is made in Facebook, it may be usef= ul to you : >=20 > http://www.erlang-factory.com/upload/presentations/31/EugeneLetuchy-Erlang= atFacebook.pdf >=20 > It's more focused on erlang, but it might give you ideas on how to deal wi= th that problem (I am not sure that DB are the best way to deal with that...= but it's just my opinion). >=20 > Victor Kabdebon > http://www.voxnucleus.fr >=20 >=20 >=20 > 2011/2/15 Sasha Dolgy > thanks for the response. thinking about this, this would not allow for th= e sorting of messages into a chronological order for end user display. i ha= d thought about having each message as its own column against the room or th= e user, but i have had some inconsistencies in retrieving the data. sometim= es i get 3 columns, sometimes i get 50...( i think this is because of the ra= ndom partitioner) > =20 > i had thought about this structure: > =20 > [messages][nickname][message id =3D> message data] > [chatrooms][room_name][message id] > =20 > this way i can pull all messages a user ever posted, not specific to a roo= m. what i haven't been able to do so far is print the timestamp on the row o= r column. does this have to be explicitly added somewhere or can it be retu= rned as part of a 'get' request?=20 > =20 > -sd > =20 > =20 > On Tue, Feb 15, 2011 at 2:12 PM, Michal August=C3=BDn wrote: > The schema design depends on chatrooms/users/messages numbers. I.e. you ca= n have one CF, where key is chatroom, column name is username, column value i= s the message and message time is the same as column timestamp. > You can add day-timestamp to the chatroom name to avoid large rows. >=20 > Augi >=20 > 2011/2/15 Andrey V. Panov >=20 > I never did it. But I suppose you can use "chatroom name" as key and store= messages & nicks as columns in JSON and timestamp as columnName. >=20 >=20 >=20 >=20 > --=20 > Sasha Dolgy > sasha.dolgy@gmail.com >=20 --Apple-Mail-3--482842421 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
There was a by here last year who did s= omething similar and did a nice write up. Cannot find it right now, some goo= gleing  may help.

Aaron


On 1= 6/02/2011, at 2:56 AM, Victor Kabdebon <victor.kabdebon@gmail.com> wrote:

Hello Sasha.

In this sort of real tim= e application the way you insert (QUORUM, ONE, etc..) and  the way you r= etrieve is extremely important because your data may not have had the time t= o propagate to all your nodes. Be sure to use adequate policies to do that := insert to a certain number of nodes but don't sacrifice to much time doing t= hat to keep the real time component.
Here is a presentation of how the chat is made in Facebook, it may be useful= to you :

http://ww= w.erlang-factory.com/upload/presentations/31/EugeneLetuchy-ErlangatFacebook.= pdf

It's more focused on erlang, but it might give you ideas on how to deal w= ith that problem (I am not sure that DB are the best way to deal with that..= . but it's just my opinion).

Victor Kabdebon
http://www.voxnucleus.f= r



2011/2/15 Sasha Dolgy <<= a href=3D"mailto:sdolgy@gmail.com" target=3D"_blank">sdolgy@gmail.com>
thanks for the response.  thinking about this, this would not allo= w for the sorting of messages into a chronological order for end user displa= y.  i had thought about having each message as its own column against t= he room or the user, but i have had some inconsistencies in retrieving the d= ata.  sometimes i get 3 columns, sometimes i get 50...( i think this is= because of the random partitioner)
 
i had thought about this structure:
 
[messages][nickname][message id =3D> message data]
[chatrooms][room_name][message id]
 
this way i can pull all messages a user ever posted, not specific to a r= oom.  what i haven't been able to do so far is print the timestamp on t= he row or column.  does this have to be explicitly added somewhere or c= an it be returned as part of a 'get' request? 
 
-sd
 
 
On Tue, Feb 15, 2011 at 2:12 PM, Michal August=C3= =BDn <augustyn.michal@g= mail.com> wrote:
The schema design d= epends on chatrooms/users/messages numbers. I.e. you can have one CF, where k= ey is chatroom, column name is username, column value is the message and mes= sage time is the same as column timestamp.=20
You can add day-timestamp to the chatroom name to avoid large rows.
=

Augi

2011/2/15 Andrey V. Panov <<= a href=3D"mailto:panov.andy@gmail.com" target=3D"_blank">panov.andy@gmail.com>=20

I never did it. But= I suppose you can use "chatroom name" as key and store messages & nicks= as columns in JSON and timestamp as columnName.




--
Sasha Dolgy
sasha.dolgy@gmail.com

= --Apple-Mail-3--482842421--