use of org.neo4j.io.pagecache.tracing.PageCacheTracer in project neo4j by neo4j.
the class ConfigurablePageCacheRule method createPageCache.
private PageCache createPageCache(FileSystemAbstraction fs, PageCacheConfig pageCacheConfig, Config config) {
PageCacheTracer tracer = selectConfig(baseConfig.tracer, pageCacheConfig.tracer, PageCacheTracer.NULL);
PageCursorTracerSupplier cursorTracerSupplier = selectConfig(baseConfig.pageCursorTracerSupplier, pageCacheConfig.pageCursorTracerSupplier, DefaultPageCursorTracerSupplier.INSTANCE);
Config finalConfig = config.withDefaults(MapUtil.stringMap(GraphDatabaseSettings.pagecache_memory.name(), "8M"));
FormattedLogProvider logProvider = FormattedLogProvider.toOutputStream(System.err);
ConfiguringPageCacheFactory pageCacheFactory = new ConfiguringPageCacheFactory(fs, finalConfig, tracer, cursorTracerSupplier, logProvider.getLog(PageCache.class)) {
@Override
public int calculatePageSize(Config config, PageSwapperFactory swapperFactory) {
if (pageCacheConfig.pageSize != null) {
return pageCacheConfig.pageSize;
}
return super.calculatePageSize(config, swapperFactory);
}
};
return pageCacheFactory.getOrCreatePageCache();
}
use of org.neo4j.io.pagecache.tracing.PageCacheTracer in project neo4j by neo4j.
the class BatchingNeoStores method batchingNeoStores.
public static BatchingNeoStores batchingNeoStores(FileSystemAbstraction fileSystem, File storeDir, RecordFormats recordFormats, Configuration config, LogService logService, AdditionalInitialIds initialIds, Config dbConfig) {
Config neo4jConfig = getNeo4jConfig(config, dbConfig);
final PageCacheTracer tracer = new DefaultPageCacheTracer();
PageCache pageCache = createPageCache(fileSystem, neo4jConfig, logService.getInternalLogProvider(), tracer, DefaultPageCursorTracerSupplier.INSTANCE);
BatchingNeoStores batchingNeoStores = new BatchingNeoStores(fileSystem, pageCache, storeDir, recordFormats, neo4jConfig, logService, initialIds, false, tracer::bytesWritten);
return batchingNeoStores;
}
use of org.neo4j.io.pagecache.tracing.PageCacheTracer in project neo4j by neo4j.
the class PageCacheCountersIT method pageCacheCountersAreSumOfPageCursorCounters.
@Test
@RepeatRule.Repeat(times = 5)
public void pageCacheCountersAreSumOfPageCursorCounters() throws Exception {
List<NodeCreator> nodeCreators = new ArrayList<>(numberOfWorkers);
List<Future> nodeCreatorFutures = new ArrayList<>(numberOfWorkers);
PageCacheTracer pageCacheTracer = getPageCacheTracer(db);
long initialPins = pageCacheTracer.pins();
long initialHits = pageCacheTracer.hits();
long initialUnpins = pageCacheTracer.unpins();
long initialBytesRead = pageCacheTracer.bytesRead();
long initialBytesWritten = pageCacheTracer.bytesWritten();
long initialEvictions = pageCacheTracer.evictions();
long initialFaults = pageCacheTracer.faults();
long initialFlushes = pageCacheTracer.flushes();
startNodeCreators(nodeCreators, nodeCreatorFutures);
TimeUnit.MILLISECONDS.sleep(50);
stopNodeCreators(nodeCreators, nodeCreatorFutures);
assertThat(pageCacheTracer.pins(), greaterThan(0L));
assertThat(pageCacheTracer.faults(), greaterThan(0L));
assertThat(pageCacheTracer.pins(), greaterThan(0L));
assertThat("Number of pins events in page cache tracer should equal to the sum of pin events in page cursor tracers.", pageCacheTracer.pins(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getPins, initialPins)));
assertThat("Number of unpins events in page cache tracer should equal to the sum of unpin events in page cursor tracers.", pageCacheTracer.unpins(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getUnpins, initialUnpins)));
assertThat("Number of initialBytesRead in page cache tracer should equal to the sum of initialBytesRead in page cursor tracers.", pageCacheTracer.bytesRead(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getBytesRead, initialBytesRead)));
assertThat("Number of bytesWritten in page cache tracer should equal to the sum of bytesWritten in page cursor tracers.", pageCacheTracer.bytesWritten(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getBytesWritten, initialBytesWritten)));
assertThat("Number of evictions in page cache tracer should equal to the sum of evictions in page cursor tracers.", pageCacheTracer.evictions(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getEvictions, initialEvictions)));
assertThat("Number of faults in page cache tracer should equal to the sum of faults in " + "page cursor tracers.", pageCacheTracer.faults(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getFaults, initialFaults)));
assertThat("Number of flushes in page cache tracer should equal to the sum of flushes in page cursor tracers.", pageCacheTracer.flushes(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getFlushes, initialFlushes)));
assertThat("Number of hits in page cache tracer should equal to the sum of hits in page cursor tracers.", pageCacheTracer.hits(), greaterThanOrEqualTo(sumCounters(nodeCreators, NodeCreator::getHits, initialHits)));
}
Aggregations