cassandra UTF8或LongType中的密钥验证类类型? [英] key validation class type in cassandra UTF8 or LongType?

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

问题描述

我想使用cassandra,在列族中存储2000万以上的行键.

Using cassandra, I want to store 20 million+ of row key in column family.

我的问题是:

  1. 长键和utf8 rowKey键之间是否存在真正的性能差异?

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

行密钥存储大小有问题吗?

any,row key storage size problem?

我的用户键是这样的

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个密钥.在任何给定时间缓存200,000个密钥是否足够,就取决于您的应用程序的要求.您可以根据可用RAM的数量来增加它,但是应该在小的增量调整中对其进行测试.

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.

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

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