使用ChronicleMap作为键值数据库 [英] Using ChronicleMap as a key-value database

查看:453
本文介绍了使用ChronicleMap作为键值数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 ChronicleMap 作为内存映射键值数据库(Stringbyte[]).它应该能够容纳多达1亿个条目.读取/获取将比写入/写入更频繁地发生,预期的写入速率小于10个条目/秒.尽管密钥的长度相似,但值的长度可能相差很大:从几字节到数十兆字节不等.但是,大多数值的长度在500到1000个字节之间.

I would like to use a ChronicleMap as a memory-mapped key-value database (String to byte[]). It should be able to hold up to the order of 100 million entries. Reads/gets will happen much more frequently than writes/puts, with an expected write rate of less than 10 entries/sec. While the keys would be similar in length, the length of the value could vary strongly: it could be anything from a few bytes up to tens of Mbs. Yet, the majority of values will have a length between 500 to 1000 bytes.

阅读了有关ChronicleMap的一些知识后,我对它的功能感到惊讶,并且想知道为什么我找不到找到描述它作为通用键值数据库的文章.对我来说,使用ChronicleMap似乎有很多优势.我在这里想念什么?

Having read a bit about ChronicleMap, I am amazed about its features and am wondering why I can't find articles describing it being used as a general key-value database. To me there seem to be a lot of advantages of using ChronicleMap for such a purpose. What am I missing here?

在给定的边界条件下使用ChronicleMap有什么缺点?

推荐答案

我投票赞成关闭该问题,因为任何缺点"都是相对的.

I voted for closing this question because any "drawbacks" would be relative.

作为数据结构,Chronicle Map不会进行排序,因此当您需要按键对排序的顺序进行迭代时,它不适合.

As a data structure, Chronicle Map is not sorted, so it doesn't fit when you need to iterate the key-value pairs in the sorted order by key.

当前实施方式的局限性在于,您需要预先指定要存储在地图中的元素数量,如果实际数量与指定数量不符,则您将过度使用内存和磁盘(尽管在Linux系统上不是很严重),但是如果实际条目数超过指定数目大约20%或更多,操作性能将开始下降,并且性能影响随着条目数的增加而线性增长.参见 https://github.com/OpenHFT/Chronicle-Map/issues/105

Limitation of the current implementation is that you need to specify the number of elements that are going to be stored in the map in advance, and if the actual number isn't close to the specified number, you are going to overuse memory and disk (not very severely though, on Linux systems), but if the actual number of entries exceeds the specified number by approximately 20% or more, operation performance starts to degrade, and the performance hit grows linearly with the number of entries growing further. See https://github.com/OpenHFT/Chronicle-Map/issues/105

这篇关于使用ChronicleMap作为键值数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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