只提供读取速度非常快的键值数据库?
我们正在 Scala 中做一个项目,我需要一个键值数据库(如地图),主要用于服务读取操作并且速度非常快:
- 没有任何外来查询支持或复杂的检索逻辑,只需提供键并获取值,就像地图一样。没有条件,没有连接,什么都没有。按键->值
- 顺便说一句,值本身就是一些字符串或类似内容的列表的映射。这意味着它有点长(如果有的话)
- 我们只是将其用于阅读。没有编写期望数据库的初始填充或一些非常罕见的更新,或者可能可以在数据库之外处理......
我已经转向 MangoDB 和 memcachedDB 但 Mango 擅长查询(这对我没有增加任何价值) )而 memcacheDB 完全与分发有关(在我的项目中不是问题)。到目前为止,我正在考虑利用 RDBMS(例如 MySQL),但也许在 NoSQL 领域有更好的选择?
We are doing a project in Scala and I need a key-value database (like a map) that is required to mainly serve read operations and do so really fast:
- No exotic query support or complex retrieval logic in any ways, just give the key and get the value, just like a map. no conditions, no joins, nothing. Key -> Value
- The value ,by the way, is itself a map of some list of some strings or something like that. meaning it's a little lengthy (if matters at all)
- We use it just for reading. No writing expect for the initial populating of the db or some very rare updates or perhaps that can be handled outside of the db ...
I've been directed towards MangoDB and memcachedDB but Mango is good at queries (which adds no value to me) and memcacheDB is all about distribution (not a concern in my project). So far I'm thinking of leveraging a RDBMS (e.g MySQL) but perhaps there are better options in the land of NoSQL ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
另一种选择是使用平面文件,数据听起来相对简单,并且您不必经常写入文件。似乎还有一个 memcached 的开源 scala 实现。这种访问速度会非常快。 https://github.com/victori/smemcached
An alternative would be just to use a flatfile, the data sounds relatively simple and you don't have to write to the file often. Seems that there is also a open source scala implementation of memcached. This access would be very fast. https://github.com/victori/smemcached
我建议 SQLite 或 Berkeley DB(具有与 SQLite 兼容的 SQL API)。两者都是简单的嵌入式数据库库——它们链接到您的应用程序,因此不需要单独的服务器。它们运行查询的速度都非常快。 Berkeley DB 对于超大型数据库具有更好的可扩展性。如果您有兴趣使用键值对 API (NoSQL),Berkeley DB 也有该 API。
祝您搜索顺利。
I would suggest SQLite or Berkeley DB (which has a SQLite-compatible SQL API). Both are simple, embedded database libraries -- they link into your application, so there is no requirement for a separate server. They are both very fast at running queries. Berkeley DB has better scalability for very large databases. If you're interested in using a key-value pair API (NoSQL), Berkeley DB has that API as well.
Good luck in your search.
我建议您看看京都内阁。我正在围绕它编写一些 Scala 包装器,允许您将它作为普通的旧式 Scala 地图进行访问。我自己还没有做过基准测试,但根据现有的基准测试,它比 Berkeley DB 更快。 (但是,现在说还为时过早,因为没有关于 Java 集成开销的文档。)
检查 此处为 JavaDoc API。我一直在 REPL 上摆弄它,效果很好。
以下是来自 REPL 的一些证明它有效的证据:
I would suggest you take a look at Kyoto Cabinet. I'm in the process of writing some Scala wrappers around it, allowing you to access it as a plain old vanilla Scala Map. I haven't done a benchmark myself yet, but according to the benchmarks out there, it's faster than Berkeley DB. (However, it may be to early to tell, since there is no documentation on the overhead of the Java integration.)
Check the JavaDoc APIs here. I have been toying with it on the REPL, and it worked fine.
Here's some proof from the REPL that it works:
Chronicle Map 是一个纯 Java 可嵌入的持久键值存储。
java.util.Map
PalDB是一次写入,用于 Java 的可嵌入、持久键值存储
Chronicle Map is a pure Java embeddable, persistent key-value store.
java.util.Map
PalDB is a write-once, embeddable, persistent key-value store for Java
MongoDB 可能是一个简单的解决方案。
http://www.mongodb.org/display/DOCS/Benchmarks
MongoDB would probably be an easy solution for this.
http://www.mongodb.org/display/DOCS/Benchmarks
MemcacheDB 听起来像是适合这项工作的工具,即使您不需要分布式网络部分(您无需执行任何操作即可使用它)。
更好的是,redis 应该非常快,并且还具有对存储列表或集合等数据结构的本机支持。
MemcacheDB sounds like the right tool for the job, even if you do not need the distributed networking part (you do not have to do anything not to use it).
Even better, redis is supposed to be very fast and also has native support for storing data structures like lists or sets.
我推荐 CDB(恒定数据库)。它有一些优点:
唯一的问题是它仅限于 4GB 数据库大小。
如果您需要更多数据,可以使用 64 位版本(Go cdb64 或 Python python-pure-cdb) 可以读取最大 16 艾字节的数据库文件。
I'd recommend CDB (Constant Data Base). It has a few advantages:
The only problem is that it's limited to 4GB database sizes.
If you need more data, there's a 64 bit version (in Go cdb64 or in Python python-pure-cdb) that can read database files up to 16 exabytes.