Re: Cassandra 0.7.4 Bug?

2011-04-17 Thread csharpplusproject
Shimi,

Chag Sameach. Yes, I know that a restart solves this, yet, I think this
is something that must be resolved as a result of 'nodetool move'.

Shalom.

-Original Message-
From: shimi shim...@gmail.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra 0.7.4 Bug?
Date: Sun, 17 Apr 2011 22:17:59 +0300

I had the same thing.
Node restart should solve it.

Shimi


On Sun, Apr 17, 2011 at 4:25 PM, Dikang Gu dikan...@gmail.com wrote:

+1.



I also met this problem several days before, and I haven't got a
solution yet...





On Sun, Apr 17, 2011 at 9:17 PM, csharpplusproject
csharpplusproj...@gmail.com wrote:

Often, I see the following behavior:

(1) Cassandra works, all nodes are up etc

(2) a 'move' operation is being run on one of the nodes

(3) following this 'move' operation, even after a couple
of hours / days where it is obvious the operation has
ended, the node which had 'moved' remains with a status
of ?

perhaps it's a bug?


___

shalom@host:/opt/cassandra/apache-cassandra-0.7.4$
bin/nodetool -host 192.168.0.5 ring
Address Status State   LoadOwns
Token   

127605887595351923798765477786913079296 
192.168.0.253   Up Normal  88.66 MB25.00%
0   
  192.168.0.4 Up Normal  558.2 MB50.00%
85070591730234615865843651857942052863  
  192.168.0.5 Up Normal  71.03 MB16.67%
113427455640312821154458202477256070485 
  192.168.0.6 Up Normal  44.71 MB8.33%
127605887595351923798765477786913079296 

shalom@host:/opt/cassandra/apache-cassandra-0.7.4$
bin/nodetool -host 192.168.0.4 move
92535295865117307932921825928971026432

shalom@host:/opt/cassandra/apache-cassandra-0.7.4$
bin/nodetool -host 192.168.0.5 ring
Address Status State   LoadOwns
Token   

127605887595351923798765477786913079296 
192.168.0.253   Up Normal  171.17 MB   25.00%
0   
192.168.0.4 ?  Normal  212.11 MB   54.39%
92535295865117307932921825928971026432  
192.168.0.5 Up Normal  263.91 MB   12.28%
113427455640312821154458202477256070485 
192.168.0.6 Up Normal  26.21 MB8.33%
127605887595351923798765477786913079296 






-- 
Dikang Gu



0086 - 18611140205








Re: Cassandra Database Modeling

2011-04-14 Thread csharpplusproject
Aaron,

Thank you so much.

So, the way things appear, it is definitely possible that I could be
making queries that would return all 10M particle pairs (at least, I
should plan for it). What would be the best design in such a case?
I read somewhere that the recommended maximum size of a row (meaning,
including all columns) should be around 10[MB], and better not to exceed
that. Is that correct?

As per packing data efficiently, what would be the best way? would
packing the data using say (in python terms) struct.pack( ... ) be at
all helpful?

Thanks,
Shalom.

-Original Message-
From: aaron morton aa...@thelastpickle.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra Database Modeling
Date: Thu, 14 Apr 2011 20:54:43 +1200

WRT your query, it depends on how big a slice you want to get how time
critical it is. e.g. Could you be making queries that would return all
10M pairs ? Or would the queries generally want to get some small
fraction of the data set? Again, depends on how the sim runs.


If you sim has stop the world pauses were you have a full view of the
data space, then you could grab all the points at a certain distance and
efficiently pack them up. Where efficiently means not using JSON.


http://wiki.apache.org/cassandra/LargeDataSetConsiderations
http://wiki.apache.org/cassandra/CassandraLimitations
 
Aaron


On 13 Apr 2011, at 15:48, csharpplusproject wrote:

 Aaron,
 
 Thank you so much for your help. It is greatly appreciated!
 
 Looking at the design of the particle pairs:
 
  
  - key: expriement_id.time_interval 
  - column name: pair_id 
  - column value: distance, angle, other data packed together as JSON
  or some other format
 
 
 You wrote that retrieving millions of columns (I will have about
 10,000,000 particles pairs) would be slow. You are also right that the
 retrieval of millions of columns into Python, won't be fast.
 
 If my desired query is to get all particle pairs on time interval
 [ Tn..T(n+1) ] where the distance between the two particles is smaller
 than X and the angle between the two particles is greater than Y.
 
 In such a query (as the above), given the fact that retrieving
 millions of columns could be slow, would it be best to say
 'concatenate' all values for all particle pairs for a given
 'expriement_id.time_interval' into one column?
 
 If data is stored in this way, I will be getting from Cassandra a
 binary string / JSON Object that I will have to 'unpack' in my
 application. Is this a recommended approach? are there better
 approaches?
 
 Is there a limit to the size that can be stored in one 'cell' (by
 'cell' I mean the intersection between a key and a data column)? is
 there a limit to the size of data of one key?  one data column?
 
 Thanks in advance for any help / guidance.
 
 -Original Message-
 From: aaron morton aa...@thelastpickle.com
 Reply-to: user@cassandra.apache.org
 To: user@cassandra.apache.org
 Subject: Re: Cassandra Database Modeling
 Date: Wed, 13 Apr 2011 10:14:21 +1200
 
 Yes for  interactive == real time queries.  Hadoop based techniques
 are non time critical queries, but they do have greater analytical
 capabilities.  
 
 particle_pairs: 1) Yes and no and sort of. Under the hood the
 get_slice api call will be used by your client library to pull back
 chunks of (ordered) columns. Most client libraries abstract away the
 chunking for you.  
 
 2) If you are using a packed structure like JSON then no, Cassandra
 will have no idea what you've put in the columns other than bytes . It
 really depends on how much data you have per pair, but generally it's
 easier to pull back more data than try to get exactly what you need.
 Downside is you have to update all the data.  
 
 3) No, you would need to update all the data for the pair. I was
 assuming most of the data was written once, and that your simulation
 had something like a stop-the-world phase between time slices where
 state was dumped and then read to start the next interval. You could
 either read it first, or we can come up with something else. 
 
 distance_cf 1) the query would return an list of columns, which have a
 name and value (as well as a timestamp and ttl). 2) depends on the
 client library, if using python go
 for https://github.com/pycassa/pycassa It will return objects  3)
 returning millions of columns is going to be slow, would also be slow
 using a RDBMS. Creating millions objects in python is going to be
 slow. You would need to have a better idea of what queries you will
 actually want to run to see if it's *too* slow. If it is one approach
 is to store the particles at the same distance in the same column, so
 you need to read less columns. Again depends on how your sim works.
 Time complexity depends on the number of columns read. Finding a row
 will not be O(1) as it it may have to read from several files. Writes
 are more constant than reads. But remember, you can have a lot of io
 and cpu power

Re: Cassandra Database Modeling

2011-04-12 Thread csharpplusproject
Aaron,

Thank you so much for your help. It is greatly appreciated!

Looking at the design of the particle pairs:

 
 - key: expriement_id.time_interval 
 - column name: pair_id 
 - column value: distance, angle, other data packed together as JSON or
 some other format


You wrote that retrieving millions of columns (I will have about
10,000,000 particles pairs) would be slow. You are also right that the
retrieval of millions of columns into Python, won't be fast.

If my desired query is to get all particle pairs on time interval
[ Tn..T(n+1) ] where the distance between the two particles is smaller
than X and the angle between the two particles is greater than Y.

In such a query (as the above), given the fact that retrieving millions
of columns could be slow, would it be best to say 'concatenate' all
values for all particle pairs for a given 'expriement_id.time_interval'
into one column?

If data is stored in this way, I will be getting from Cassandra a binary
string / JSON Object that I will have to 'unpack' in my application. Is
this a recommended approach? are there better approaches?

Is there a limit to the size that can be stored in one 'cell' (by 'cell'
I mean the intersection between a key and a data column)? is there a
limit to the size of data of one key?  one data column?

Thanks in advance for any help / guidance.

-Original Message-
From: aaron morton aa...@thelastpickle.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra Database Modeling
Date: Wed, 13 Apr 2011 10:14:21 +1200

Yes for  interactive == real time queries.  Hadoop based techniques are
non time critical queries, but they do have greater analytical
capabilities. 


particle_pairs:
1) Yes and no and sort of. Under the hood the get_slice api call will be
used by your client library to pull back chunks of (ordered) columns.
Most client libraries abstract away the chunking for you. 


2) If you are using a packed structure like JSON then no, Cassandra will
have no idea what you've put in the columns other than bytes . It really
depends on how much data you have per pair, but generally it's easier to
pull back more data than try to get exactly what you need. Downside is
you have to update all the data. 


3) No, you would need to update all the data for the pair. I was
assuming most of the data was written once, and that your simulation had
something like a stop-the-world phase between time slices where state
was dumped and then read to start the next interval. You could either
read it first, or we can come up with something else.


distance_cf
1) the query would return an list of columns, which have a name and
value (as well as a timestamp and ttl).
2) depends on the client library, if using python go
for https://github.com/pycassa/pycassa It will return objects 
3) returning millions of columns is going to be slow, would also be slow
using a RDBMS. Creating millions objects in python is going to be slow.
You would need to have a better idea of what queries you will actually
want to run to see if it's *too* slow. If it is one approach is to store
the particles at the same distance in the same column, so you need to
read less columns. Again depends on how your sim works. 
  
Time complexity depends on the number of columns read. Finding a row
will not be O(1) as it it may have to read from several files. Writes
are more constant than reads. But remember, you can have a lot of io and
cpu power in your cluster.


Best advice is to jump in and see if the data model works for you at a
small single node scale, most performance issues can be solved. 


Aaron

On 12 Apr 2011, at 15:34, csharpplusproject wrote:

 Hi Aaron,
 
 Yes, of course it helps, I am starting to get a flavor of Cassandra --
 thank you very much!
 
 First of all, by 'interactive' queries, are you referring to
 'real-time' queries? (meaning, where experiments data is 'streaming',
 data needs to be stored and following that, the query needs to be run
 in real time)?
 
 Looking at the design of the particle pairs:
 
 - key: expriement_id.time_interval 
 - column name: pair_id 
 - column value: distance, angle, other data packed together as JSON or
 some other format
 
 A couple of questions:
 
 (1) Will a query such as pairID[ expriement_id.time_interval ] will
 basically return an array of all paidIDs for the experiment, where
 each item is a 'packed' JSON?
 (2) Would it be possible, rather than returning the whole JSON object
 per every pairID, to get (say) only the distance?
 (3) Would it be possible to easily update certain 'pairIDs' with new
 values (for example, update pairIDs = {2389, 93434} with new distance
 values)? 
 
 Looking at the design of the distance CF (for example):
 
 this is VERY INTERESTING. basically you are suggesting a design that
 will save the actual distance between each pair of particles, and will
 allow queries where we can find all pairIDs (for an experiment, on
 time_interval) that meet

Re: Cassandra Database Modeling

2011-04-12 Thread csharpplusproject
Steven,

Thank you. 

You wrote: The data of cassandra are partitioned by the row key;
therefore, if you want to put all pairs into the same row, you should
consider the disk size

Can you please explain why the disk size is / might be a problem?

Thanks,
Shalom.

-Original Message-
From: Steven Yen-Liang Su xpste...@gmail.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra Database Modeling
Date: Wed, 13 Apr 2011 12:16:00 +0800

Is there a limit to the size that can be stored in one
'cell' (by 'cell' I mean the intersection between a key and a
data column)? is there a limit to the size of data of one key?
one data column?



http://wiki.apache.org/cassandra/CassandraLimitations


The data of cassandra are partitioned by the row key; therefore, if you
want to put all pairs into the same row, you should consider the disk
size.
 

Thanks in advance for any help / guidance.

-Original Message-
From: aaron morton aa...@thelastpickle.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra Database Modeling
Date: Wed, 13 Apr 2011 10:14:21 +1200

Yes for  interactive == real time queries.  Hadoop based
techniques are non time critical queries, but they do have
greater analytical capabilities.  

particle_pairs: 1) Yes and no and sort of. Under the hood the
get_slice api call will be used by your client library to pull
back chunks of (ordered) columns. Most client libraries abstract
away the chunking for you.  

2) If you are using a packed structure like JSON then no,
Cassandra will have no idea what you've put in the columns other
than bytes . It really depends on how much data you have per
pair, but generally it's easier to pull back more data than try
to get exactly what you need. Downside is you have to update all
the data.  

3) No, you would need to update all the data for the pair. I was
assuming most of the data was written once, and that your
simulation had something like a stop-the-world phase between
time slices where state was dumped and then read to start the
next interval. You could either read it first, or we can come up
with something else. 

distance_cf 1) the query would return an list of columns, which
have a name and value (as well as a timestamp and ttl). 2)
depends on the client library, if using python go
for https://github.com/pycassa/pycassa It will return objects
3) returning millions of columns is going to be slow, would also
be slow using a RDBMS. Creating millions objects in python is
going to be slow. You would need to have a better idea of what
queries you will actually want to run to see if it's *too* slow.
If it is one approach is to store the particles at the same
distance in the same column, so you need to read less columns.
Again depends on how your sim works. Time complexity depends
on the number of columns read. Finding a row will not be O(1) as
it it may have to read from several files. Writes are more
constant than reads. But remember, you can have a lot of io and
cpu power in your cluster. 

Best advice is to jump in and see if the data model works for
you at a small single node scale, most performance issues can be
solved.  

Aaron 
On 12 Apr 2011, at 15:34, csharpplusproject wrote: 

 Hi Aaron,
 
 Yes, of course it helps, I am starting to get a flavor of
 Cassandra -- thank you very much!
 
 First of all, by 'interactive' queries, are you referring to
 'real-time' queries? (meaning, where experiments data is
 'streaming', data needs to be stored and following that, the
 query needs to be run in real time)?
 
 Looking at the design of the particle pairs:
 
 - key: expriement_id.time_interval 
 - column name: pair_id 
 - column value: distance, angle, other data packed together as
 JSON or some other format
 
 A couple of questions:
 
 (1) Will a query such as pairID[ expriement_id.time_interval ]
 will basically return an array of all paidIDs for the
 experiment, where each item is a 'packed' JSON?
 (2) Would it be possible, rather than returning the whole JSON
 object per every pairID, to get (say) only the distance?
 (3) Would it be possible to easily update certain 'pairIDs'
 with new values (for example, update pairIDs = {2389, 93434}
 with new distance values

Re: Cassandra Database Modeling

2011-04-11 Thread csharpplusproject
Hi Aaron,

Yes, of course it helps, I am starting to get a flavor of Cassandra --
thank you very much!

First of all, by 'interactive' queries, are you referring to 'real-time'
queries? (meaning, where experiments data is 'streaming', data needs to
be stored and following that, the query needs to be run in real time)?

Looking at the design of the particle pairs:

- key: expriement_id.time_interval 
- column name: pair_id 
- column value: distance, angle, other data packed together as JSON or
some other format

A couple of questions:

(1) Will a query such as pairID[ expriement_id.time_interval ] will
basically return an array of all paidIDs for the experiment, where each
item is a 'packed' JSON?
(2) Would it be possible, rather than returning the whole JSON object
per every pairID, to get (say) only the distance?
(3) Would it be possible to easily update certain 'pairIDs' with new
values (for example, update pairIDs = {2389, 93434} with new distance
values)? 

Looking at the design of the distance CF (for example):

this is VERY INTERESTING. basically you are suggesting a design that
will save the actual distance between each pair of particles, and will
allow queries where we can find all pairIDs (for an experiment, on
time_interval) that meet a certain distance criteria. VERY, VERY
INTERESTING!

A couple of questions:

(1) Will a query such as distanceCF[ expriement_id.time_interval ] will
basically return an array of all 'zero_padded_distance.pair_id' elements
for the experiment?
(2) In such a case, I will get (presumably) a python list where every
item is a string (and I will need to process it)?
(3) Given the fact that we're doing a slice on millions of columns (?),
any idea how fast such an operation would be?


Just to make sure I understand, is it true that in both situations, the
query complexity is basically O(1) since it's simply a HASH?


Thank you for all of your help!

Shalom.

-Original Message-
From: aaron morton aa...@thelastpickle.com
Reply-to: user@cassandra.apache.org
To: user@cassandra.apache.org
Subject: Re: Cassandra Database Modeling
Date: Tue, 12 Apr 2011 10:43:42 +1200

The tricky part here is the level of flexibility you want for the
querying. In general you will want to denormalise to support the read
queries.  


If your queries are not interactive you may be able to use Hadoop /
Pig / Hive e.g. http://www.datastax.com/products/brisk In which case you
can probably have a simpler data model where you spend less effort
supporting the queries. But it sounds like you need interactive queries
as part of the experiment.


You could store the data per pair in a standard CF (lets call it the
pair cf) as follows:


- key: expriement_id.time_interval
- column name: pair_id
- column value: distance, angle, other data packed together as JSON or
some other format


This would support a basic record of what happened, for each time
interval you can get the list of all pairs and read their data. 


To support your spatial queries you could use two standard standard CFs
as follows:


distance CF:
- key: experiment_id.time_interval
- colunm name: zero_padded_distance.pair_id
- column value: empty or the angle 


angle CF :
- key: experiment_id.time_interval
- colunm name: zero_padded_angle.pair_id
- column value: empty or the distance


(two pairs can have the same distance and/or angle in same time slice)


Here we are using the column name as a compound value, and am assuming
they can be byte ordered. So for distance the column name looks
something like 000500.123456789. You would then use the Byte comparator
(or similar) for the columns.  


To find all of the particles for experiment 2 at t5 where distance is 
100 you would use a get_slice
(see http://wiki.apache.org/cassandra/API or your higher level client
docs) against the key 2.5 with a SliceRange start at
00.0 and finish at 000100.9. Once you have this
list of columns you can either filter client side for the angle or issue
another query for the particles inside the angle range. Then join the
two results client side using the pair_id returned in the column names. 


By using the same key for all 3 CF's all the data for a time slice will
be stored on the same nodes. You can potentially spread this around by
using slightly different keys so they may hash to different areas of the
cluster. e.g. expriement_id.time_interval.distance


Data volume is not a concern, and it's not possible to talk about
performance until you have an idea of the workload and required
throughput. But writes are fast and I think your reads would be fast as
well as the row data for distance and angle will not change so caches
will be be useful. 
 


Hope that helps. 
Aaron


On 12 Apr 2011, at 03:01, Shalom wrote:

 I would like to save statistics on 10,000,000 (ten millions) pairs of
 particles, how they relate to one another in any given space in time.
 
 So suppose that within a total experiment time of T1..T1000 (assume
 that T1
 is