public int getInitialSegmentTableSize() { return Math.max(1, getSegmentDataPageSize() / assumedKeyValueSize); }
@Override public String toString() { String sb = "Heuristic Configuration: \n" + "Maximum Size (specified) : " + DebuggingUtils.toBase2SuffixedString(getMaximumSize()) + "B\n" + "Minimum Chunk Size : " + DebuggingUtils.toBase2SuffixedString(getMinimumChunkSize()) + "B\n" + "Maximum Chunk Size : " + DebuggingUtils.toBase2SuffixedString(getMaximumChunkSize()) + "B\n" + "Concurrency : " + getConcurrency() + "\n" + "Initial Segment Table Size : " + DebuggingUtils.toBase2SuffixedString(getInitialSegmentTableSize()) + " slots\n" + "Segment Data Page Size : " + DebuggingUtils.toBase2SuffixedString(getSegmentDataPageSize()) + "B\n"; return sb; }
private EhcacheConcurrentOffHeapClockCache<K, OffHeapValueHolder<V>> createBackingMap(long size, Serializer<K> keySerializer, Serializer<V> valueSerializer, SwitchableEvictionAdvisor<K, OffHeapValueHolder<V>> evictionAdvisor) { HeuristicConfiguration config = new HeuristicConfiguration(size); PageSource source = new UpfrontAllocatingPageSource(getBufferSource(), config.getMaximumSize(), config.getMaximumChunkSize(), config.getMinimumChunkSize()); Portability<K> keyPortability = new SerializerPortability<>(keySerializer); Portability<OffHeapValueHolder<V>> elementPortability = new OffHeapValueHolderPortability<>(valueSerializer); Factory<OffHeapBufferStorageEngine<K, OffHeapValueHolder<V>>> storageEngineFactory = OffHeapBufferStorageEngine.createFactory(PointerSize.INT, source, config .getSegmentDataPageSize(), keyPortability, elementPortability, false, true); Factory<? extends PinnableSegment<K, OffHeapValueHolder<V>>> segmentFactory = new EhcacheSegmentFactory<>( source, storageEngineFactory, config.getInitialSegmentTableSize(), evictionAdvisor, mapEvictionListener); return new EhcacheConcurrentOffHeapClockCache<>(evictionAdvisor, segmentFactory, config.getConcurrency()); }
public int getInitialSegmentTableSize() { return Math.max(1, getSegmentDataPageSize() / assumedKeyValueSize); }
@Override public String toString() { String sb = "Heuristic Configuration: \n" + "Maximum Size (specified) : " + DebuggingUtils.toBase2SuffixedString(getMaximumSize()) + "B\n" + "Minimum Chunk Size : " + DebuggingUtils.toBase2SuffixedString(getMinimumChunkSize()) + "B\n" + "Maximum Chunk Size : " + DebuggingUtils.toBase2SuffixedString(getMaximumChunkSize()) + "B\n" + "Concurrency : " + getConcurrency() + "\n" + "Initial Segment Table Size : " + DebuggingUtils.toBase2SuffixedString(getInitialSegmentTableSize()) + " slots\n" + "Segment Data Page Size : " + DebuggingUtils.toBase2SuffixedString(getSegmentDataPageSize()) + "B\n"; return sb; }
private EhcacheConcurrentOffHeapClockCache<K, OffHeapValueHolder<V>> createBackingMap(long size, Serializer<K> keySerializer, Serializer<V> valueSerializer, SwitchableEvictionAdvisor<K, OffHeapValueHolder<V>> evictionAdvisor) { HeuristicConfiguration config = new HeuristicConfiguration(size); PageSource source = new UpfrontAllocatingPageSource(getBufferSource(), config.getMaximumSize(), config.getMaximumChunkSize(), config.getMinimumChunkSize()); Portability<K> keyPortability = new SerializerPortability<>(keySerializer); Portability<OffHeapValueHolder<V>> elementPortability = new OffHeapValueHolderPortability<>(valueSerializer); Factory<OffHeapBufferStorageEngine<K, OffHeapValueHolder<V>>> storageEngineFactory = OffHeapBufferStorageEngine.createFactory(PointerSize.INT, source, config .getSegmentDataPageSize(), keyPortability, elementPortability, false, true); Factory<? extends PinnableSegment<K, OffHeapValueHolder<V>>> segmentFactory = new EhcacheSegmentFactory<>( source, storageEngineFactory, config.getInitialSegmentTableSize(), evictionAdvisor, mapEvictionListener); return new EhcacheConcurrentOffHeapClockCache<>(evictionAdvisor, segmentFactory, config.getConcurrency()); }