jankotek / mapdb

MapDB provides concurrent Maps, Sets and Queues backed by disk storage or off-heap-memory. It is a fast and easy to use embedded Java database engine.
https://mapdb.org
Apache License 2.0
4.9k stars 872 forks source link

Better documentation on how evicition / TTLs / limits works - HTreeMap #729

Open lkolek opened 8 years ago

lkolek commented 8 years ago

Based on doc it is hard to understand how eviction / overflow realy works.

Also, If I understand correctly, overflow works only for evicted (purged) records. Is there a good / prefered way to save all records to overflow htreemap before close?

jankotek commented 8 years ago

Yes, most of this is correct. ExpireStoreSize should be in bytes.

s there a good / prefered way to save all records to overflow htreemap before close?

Clear on memory map moves all records into overflow map.

I need to document this and get Mapdb-JCache plugin running. Will keep this open until its fixed.

nddipiazza commented 6 years ago

Yeah this would be great to have this documentation. I'd be happy to add it.

I have a 12G JVM that I was able to create a 60G mapdb hashmap. no problem.

So then later on in my program I need to sequentially process each entry in this hashmap with multiple threads.

But when reading the store, it causes OOMs when doing the reading.

So I'm in the need of setting up the expires. But it's hard to figure out what each parameter does due to lack of documentation. I have been reading the code and using this PR to figure out what to do. Perhaps I can help out and contribute some documentation.

The most confusing part is probably what he mentions above about how expireAfter[Get/Update/Create] needs to be used in order to activate evictions. And then how they all work together along with the expire store size, expire max size, ...