Answering additional questions:
I implemented SizedReader + Writer. Do I need DataAccess or SizedWriter fast enough for primitive arrays? I looked at ByteArrayDataAccess, but it is not clear how to port it for long arrays, given that the internal HeapBytesStore is so specific for the [] / ByteBuffers byte?
Using DataAccess instead of SizedWriter allows SizedWriter to make one copy of data of a lower value on Map.put(key, value) . However, if in your use case putOneValue() (as in the example above) is the dominant type of request, this will not make much difference. If Map.put(key, value) (and replace() , etc., T. E. Any "full write value" operations) are important, it is still possible to implement DataAccess for LongList . It will look like this:
class LongListDataAccess implements DataAccess<LongList>, Data<LongList>, StatefulCopyable<LongListDataAccess> { transient ByteStore cachedBytes; transient boolean cachedBytesInitialized; transient LongList list; @Override public Data<LongList> getData(LongList list) { this.list = list; this.cachedBytesInitialized = false; return this; } @Override public long size() { return ((long) list.size()) * Long.BYTES; } @Override public void writeTo(RandomDataOutput target, long targetOffset) { for (int i = 0; i < list.size(); i++) { target.writeLong(targetOffset + ((long) i) * Long.BYTES), list.get(i)); } } ... }
For efficiency, the size() and writeTo() methods are key. But it is also important to correctly implement all other methods (which I did not write here). Carefully read the DataAccess , Data and StatefulCopyable javadocs, as well as Understanding StatefulCopyable , DataAccess and SizedReader and Custom Serialization Checklist in the tutorial with great attention too.
Is a read / write lock a mediator when reading and writing multiple processes on one computer or in only one process?
This is process safe, note that the interface is called InterProcessReadWriteUpdateLock .
When storing objects with a variable size not known in advance, how will the values โโcause fragmentation from the heap and in the saved file?
Saving the value for the key once and not changing the size of the value (and not deleting the keys) after that will not lead to fragmentation violation. Resizing a value or deleting keys can cause external fragmentation. ChronicleMapBuilder.actualChunkSize() configuration allows you to trade between external and internal fragmentation. The larger the piece, the less fragmentation, and the more internal fragmentation. If your values โโare significantly larger than the page size (4K), you can set an absurdly large block size and still have internal fragmentation related to the page size, since the Chronicle Map can use the lazy page layout feature on Linux.