We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 1 year ago.
The community reviewed whether to reopen this question 1 year ago and left it closed:
Original close reason(s) were not resolved
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(8)
MapDB
MapDB 提供由磁盘存储或堆外内存支持的并发 TreeMap 和 HashMap。它是一个快速、可扩展且易于使用的嵌入式 Java 数据库引擎。它具有事务、节省空间的序列化、实例缓存和透明压缩/加密等功能。它还具有只有本机嵌入式数据库引擎才能媲美的卓越性能。
http://www.mapdb.org/
jdbm2
嵌入式键值 Java 数据库。
https://code.google.com/p/jdbm2/
MapDB
MapDB provides concurrent TreeMap and HashMap backed by disk storage or off-heap-memory. It is a fast, scalable and easy to use embedded Java database engine. It is packed with features such as transactions, space efficient serialization, instance cache and transparent compression/encryption. It also has outstanding performance rivaled only by native embedded db engines.
http://www.mapdb.org/
jdbm2
Embedded Key Value Java database.
https://code.google.com/p/jdbm2/
在
2018
中,最轻的持久键值
存储是 H2 数据库及其 MVStore:h2-mvstore 没有依赖项,并且版本 1.4.200 是 0.3 Mb
我还查看了:
13 meg
依赖项)5.5 meg
依赖项 - 快速可选分发)2 meg
java 依赖项 +lmdb
C 库) - 最快的实现,但不是开箱即用的线程安全
。In
2018
the lightest persistentkey value
store is the H2 Database with it's MVStore:h2-mvstore has no dependencies and version 1.4.200 is a single jar of 0.3 Mb
I also looked at:
13 meg
dependencies)5.5 meg
dependencies - fast optionally distributed)2 meg
java dependencies +lmdb
C library) - fastest implementation but notthread safe
out of the box.属性文件 或 Berkeley DB 可能就是您要找的。
java.util.Properties
本身实现了java.util.Map
,并提供了加载
和存储
到文件的方法。 Berkeley DB 通常被推荐作为轻量级键值对数据存储。Either properties files or Berkeley DB might be what you're looking for. The
java.util.Properties
itself implementsjava.util.Map
and provides methods toload
from andstore
to a file. The Berkeley DB is often been recommended as a lightweight key-value pair datastore.听起来你需要一些接近轻量级数据库的东西。您是否看过/考虑过 Java DB?单个索引表基本上是基于磁盘的线程安全哈希映射。
Sounds like you need something close to a lightweight db. Have you looked at/considered Java DB? A light db with a single, indexed table would basically be a disk-based, thread-safe hash map.
JDBM2 正是您所要求的。它提供了一个由磁盘存储备份的 HashMap(以及其他映射)。它快速、线程安全并且 API 非常简单。
JDBM2 is exactly what you are asking. It provides a HashMap backed up by disk storage (among other maps). Its fast, thread-safe and the API is really simple.
Chronicle Map 实现
ConcurrentMap
并保存数据通过将内存映射到文件到磁盘。Chronicle Map 在概念上与 MapDB 非常相似(提供类似的构建器 API 和
Map
接口),但 Chronicle Map 是 比 MapDB 快 倍,并且具有更好的并发性(Chronicle Map 使用高度条带化的多级自旋锁)。Chronicle Map implements
ConcurrentMap
and persists data to disk via mapping it's memory to a file.Chronicle Map is conceptually very similar to MapDB (provides similar builder API and
Map
interface), but Chronicle Map is times faster than MapDB and has much better concurrency (Chronicle Map uses highly striped multi-level spin locks).Project Voldemort 也是一个非常快速/可扩展/复制的“哈希映射”。它在 LinkedIn 上使用,性能也相当不错:
来自他们网站的引用:
Project Voldemort is also a really fast/scalable/replication "Hashmap". It is used at LinkedIn an performance is also pretty good:
A quote from their site:
现在是 2016 年。如果有人想解决这个问题,我发现 Xodus 中的低级环境 API JetBrains 的 使用其
computeInTransaction
存储 lambda 来实现相同的目的。当然,它不像纯
Map
实例那么灵活,但它适用于我的用例。最近的另一个选择是使用 H2 的
MVStore
存储引擎同样的事情,但我认为它更适合数据库本身。干杯!
So the year is now 2016. And if anyone's looking to tackle this problem, I found out that the low level environments API in Xodus from JetBrains works for this same purpose, using their
computeInTransaction
store lambdas.Granted, it's not as slick as having a pure
Map
instance, but it worked for my use case.Another recent option is to use H2's
MVStore
storage engine which does the same thing, but I think it's more tailored towards the database itself.Cheers!