1

我目前正在为 App Engine 实现一个数据存储连接器以使用 Cassandra。

我正在考虑如何实现Ancestor Paths。我想在 Cassandra 中使用Ordered Partitioners并构造我的密钥parent/{key_name or id},我可以使用Cassandra http://wiki.apache.org/cassandra/API#KeyRange API 中的KeyRange

你认为这是个好主意吗?因为在 datastax 上我们可以使用 Ordered Partitioners 读取,所以并不推荐http://www.datastax.com/docs/0.8/cluster_architecture/partitioning

我真的很想知道谷歌是否这样做,因为我认为实体是按键排序的。

4

1 回答 1

0

HBase is much closer to Google's Bigtable than Cassandra is. Cassandra only uses the data model from Bigtable, and Dynamo's distribution model. If one of your primary operations is to scan over key ranges you should not go with Cassandra.

If you must use Cassandra, one way of scanning over key ranges is to use columns to create hierarchy. Basically you create a row for the lowest level, then map the rest of the hierarchy to column names. "parent" would be the row key and the "key_name or id" part would be the column keys. With that model you can scan over a key range by loading a column slice.

Whether or not this is a good idea depends a lot on how your data model looks, I'm not familiar with ancestor paths in GAE, but if you have lots of "parent" things you will get a good balance across the cluster, but if you have few, and lots "key_name or id" it will be inefficient.

于 2012-06-03T18:53:43.640 回答