简体   繁体   English

它们是Java的Map的任何体面的磁盘实现吗?

[英]Are they any decent on-disk implementations of Java's Map?

I'm looking for an on-disk implementation of java.util.Map . 我正在寻找java.util.Map的磁盘实现。 Nothing too fancy, just something that I can point at a directory or file and have it store its contents there, in some way it chooses. 没有什么太花哨的东西,只是我可以指向一个目录或文件并让它以其选择的某种方式将其内容存储在那里。 Does anyone know of such a thing? 有谁知道这样的事情?

You could have a look at the Disk-Backed-map project. 您可以查看Disk-Backed-map项目。

A library that implements a disk backed map in Java 在Java中实现磁盘支持映射的库

A small library that provide a disk backed map implementation for storing large number of key value pairs. 一个小型库,提供用于存储大量键值对的磁盘支持的映射实现。 The map implementations (HashMap, HashTable) max out around 3-4Million keys/GB of memory for very simple key/value pairs and in most cases the limit is much lower. 对于非常简单的键/值对,地图实现(HashMap,HashTable)最大可以输出大约3-4百万个键/ GB内存,并且在大多数情况下,限制要低得多。 DiskBacked map on the other hand can store betweeen 16Million (64bit JVM) to 20Million(32bit JVM) keys/GB, regardless the size of the key/value pairs. 另一方面,DiskBacked地图可以存储在16Million(64bit JVM)到20Million(32bit JVM)密钥/ GB之间,无论密钥/值对的大小如何。

If you are looking for key-object based structures to persist data then NoSQL databases are a very good choice. 如果您正在寻找基于key-object的结构来保存数据,那么NoSQL数据库是一个非常好的选择。 You'll find that some of them such MongoDB or Redis scale and perform for big datasets and apart from hash based look ups they provide interesting query and transactional features. 您会发现其中一些MongoDBRedis可以扩展并执行大数据集,除了基于哈希的查找外,它们还提供了有趣的查询和事务功能。

In essence these types of systems are a Map implementation. 实质上,这些类型的系统是Map实现。 And it shouldn't be too complicated to implement your own adapter that implements java.util.Map to bridge them. 并且实现自己的适配器实现java.util.Map来桥接它们应该不会太复杂。

MapDB ( mapdb.org ) does exactly what you are looking for. MapDB( mapdb.org )完全符合您的要求。 Besides disk backed TreeMap and HashMap it gives you other collection types. 除了磁盘支持的TreeMap和HashMap,它还为您提供了其他集合类型。

It's maps are also thread-safe and have really good performance. 它的地图也是线程安全的,并且具有非常好的性能。

See Features 查看功能

You could use a simple EHCache implementation? 您可以使用简单的EHCache实现吗? The nice thing about EHCache being that it can be very simple to implement :-) EHCache的优点在于它可以非常简单地实现:-)

I take it you've ruled out serialising / deserialising an actual Map instance? 我认为你排除了序列化/反序列化实际的Map实例?

This seems like a relatively new open source solution to the problem, I've used it, and like it so far 对于这个问题,这似乎是一个相对较新的开源解决方案,我已经使用过它,并且到目前为止还喜欢它

https://github.com/jankotek/JDBM4 https://github.com/jankotek/JDBM4

Chronicle Map is a modern and the fastest solution to this problem. Chronicle Map是解决这个问题的现代化和最快速的解决方案。 It implements ConcurrentMap interface and persists the data to disk (under the hood, it is done by mapping Chronicle Map's memory to a file). 它实现了ConcurrentMap接口并将数据保存到磁盘(在引擎盖下,它通过将Chronicle Map的内存映射到文件来完成)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM