mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Make max hashLookup load factor (for tiering) greater than max 'normal'
load factor (0.66), to avoid tiering due to natural variance in segment load. Account non-tiered segments percentile
This commit is contained in:
@@ -24,6 +24,7 @@ import net.openhft.chronicle.core.OS;
|
||||
import net.openhft.chronicle.hash.ChronicleHashBuilder;
|
||||
import net.openhft.chronicle.hash.ChronicleHashBuilderPrivateAPI;
|
||||
import net.openhft.chronicle.hash.ChronicleHashInstanceBuilder;
|
||||
import net.openhft.chronicle.hash.impl.CompactOffHeapLinearHashTable;
|
||||
import net.openhft.chronicle.hash.impl.stage.entry.ChecksumStrategy;
|
||||
import net.openhft.chronicle.hash.impl.util.math.PoissonDistribution;
|
||||
import net.openhft.chronicle.hash.replication.*;
|
||||
@@ -971,6 +972,17 @@ public final class ChronicleMapBuilder<K, V> implements
|
||||
return segments;
|
||||
}
|
||||
|
||||
long tierHashLookupCapacity() {
|
||||
long entriesPerSegment = entriesPerSegment();
|
||||
long capacity = CompactOffHeapLinearHashTable.capacityFor(entriesPerSegment);
|
||||
long maxEntriesPerTier = PoissonDistribution.inverseCumulativeProbability(
|
||||
entriesPerSegment, nonTieredSegmentsPercentile);
|
||||
while (maxEntriesPerTier > MAX_LOAD_FACTOR * capacity) {
|
||||
capacity *= 2;
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
|
||||
int segmentHeaderSize() {
|
||||
int segments = actualSegments();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user