Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
180 views
in Technique[技术] by (71.8m points)

java - 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?
question from:https://stackoverflow.com/questions/65946564/how-does-the-number-of-entries-defined-on-the-builder-to-a-persisted-chroniclema

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...