键验证类类型在cassadra UTF8或LongType? [英] key validation class type in cassadra UTF8 or LongType?

查看:149
本文介绍了键验证类类型在cassadra UTF8或LongType?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是cassandra的新手,我想在列族中存储2000万行键。

i am newbie in cassandra and i want to store 20 million+ of row key in column family.

我的问题是

1. long和utf8 rowKey键之间存在REAL性能差异?

1.Is there a REAL performance difference between long and utf8 rowKey keys?

2.any,行键存储大小问题?

2.any,row key storage size problem ?

我的userkey看起来像这样

my userkey look like this

rowKey=>112512462152451
rowKey=>135431354354343
rowKey=>145646546546463
rowKey=>154354354354354
rowKey=>156454343435435
rowKey=>154435435435745

提前感谢

推荐答案


  1. Cassandra会将磁盘上的所有数据(包括行键值)存储为十六进制字节数组。在性能方面,行键的数据类型并不重要。唯一重要的地方是,行键的类型验证器/比较器将影响磁盘排序顺序。因此,在您的情况下,Long会以不同的方式排序(数字)比UTF8(ascii-betical)。

  1. Cassandra stores all data on disk (including row key values) as a hex byte array. In terms of performance, the datatype of the row key really doesn't matter. The only place that it does matter, is that the type validator/comparator of the row key will affect the on-disk sort order. So in your case, a Long will sort differently (numerical) than a UTF8 (ascii-betical).

,但我记得读取一个行键的最大大小是64K(你似乎是下面的方式)。默认情况下启用密钥缓存,并且将缓存200,000个密钥,除非另有规定。在任何给定时间缓存20万个密钥是否足够,是否满足您的应用程序的要求。

I can't find an exact source on this, but I recall reading that the max size of a row key is 64K (and you appear to be way under that). Key caching is enabled by default and will cache 200,000 keys unless otherwise specified. Whether caching 200,000 keys at any given time is enough, is up to the requirements of your application. You can increase that based on the amount of available RAM, but you should test that in small incremental adjustments.

检查Datastax文档中有关如何调整行和键缓存属性

Check the Datastax docs for instructions on how to tune the row and key cache properties.

此外, eBay发表了一篇关于Cassandra数据建模的好文章,讨论正确的行键选择/创建,也可能有助于你。

Also eBay posted a good article on Cassandra data modeling that discusses proper row key selection/creation that might also be of help to you.

这篇关于键验证类类型在cassadra UTF8或LongType?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆