Search code examples
javamapsmemory-mapped-fileschroniclechronicle-map

How does the number of entries defined on the builder to a persisted ChronicleMap impact it's ability to scale?


Each example of Chronicle map needs to be given an "entries" size in the builder but I don't understand the impact this value has on a persisted map:

 ChronicleMap
    .of(Long.class, Point.class)
    .averageValueSize(8)
    .valueMarshaller(PointSerializer.getInstance())
    .entries(999)
    .createOrRecoverPersistedTo(new File("my-map"));
  1. What happens when I insert more than 999 entries into this map?
  2. Is this number defining the number of entries Chronicle or the memory mapped find should be holding in memory for me?

Solution

  • If the number of entries is too small, it will have to resize, which comes at a small cost, and it won't be arranged as efficiently.

    In general, it is better to oversize the map so you don't have to worry about this. On Linux systems it uses sparse files so you might not even end up using more disk space.