Search in sources :

Example 1 with DefaultPageCacheTracer

use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.

the class MuninnPageCacheStressIT method shouldHandleTheStressOfOneMillionEvictions.

@Test
public void shouldHandleTheStressOfOneMillionEvictions() throws Exception {
    DefaultPageCacheTracer monitor = new DefaultPageCacheTracer();
    Condition condition = numberOfEvictions(monitor, 1_000_000);
    PageCacheStressTest runner = new PageCacheStressTest.Builder().withWorkingDirectory(testDirectory.directory()).with(monitor).with(condition).build();
    runner.run();
}
Also used : Condition(org.neo4j.io.pagecache.stress.Condition) PageCacheStressTest(org.neo4j.io.pagecache.stress.PageCacheStressTest) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) PageCacheStressTest(org.neo4j.io.pagecache.stress.PageCacheStressTest) Test(org.junit.Test)

Example 2 with DefaultPageCacheTracer

use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.

the class NeoStoresTest method tracePageCacheAccessOnTransactionCloseCall.

@Test
void tracePageCacheAccessOnTransactionCloseCall() {
    StoreFactory factory = getStoreFactory(Config.defaults(), databaseLayout, fs, LOG_PROVIDER);
    try (NeoStores neoStore = factory.openAllNeoStores(true)) {
        MetaDataStore store = neoStore.getMetaDataStore();
        var cacheTracer = new DefaultPageCacheTracer();
        var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnTransactionCloseCall"));
        store.transactionClosed(store.nextCommittingTransactionId(), 6666, 15, cursorContext);
        PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
        assertEquals(1, cursorTracer.pins());
        assertEquals(1, cursorTracer.hits());
        assertEquals(1, cursorTracer.unpins());
    }
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 3 with DefaultPageCacheTracer

use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.

the class NeoStoresIT method tracePageCacheAccessOnUpdateRecord.

@Test
void tracePageCacheAccessOnUpdateRecord() {
    var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    var neoStores = storageEngine.testAccessNeoStores();
    var nodeStore = neoStores.getNodeStore();
    long nodeId;
    try (Transaction transaction = db.beginTx()) {
        var node = transaction.createNode();
        node.setProperty("a", "b");
        nodeId = node.getId();
        transaction.commit();
    }
    var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnUpdateRecord"));
    nodeStore.updateRecord(new NodeRecord(nodeId), cursorContext);
    PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
    assertEquals(5, cursorTracer.hits());
    assertEquals(6, cursorTracer.pins());
    assertEquals(6, cursorTracer.unpins());
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 4 with DefaultPageCacheTracer

use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.

the class NeoStoresIT method tracePageCacheAccessOnHighIdScan.

@Test
void tracePageCacheAccessOnHighIdScan() {
    var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    var neoStores = storageEngine.testAccessNeoStores();
    var propertyStore = neoStores.getPropertyStore();
    for (int i = 0; i < 1000; i++) {
        try (Transaction transaction = db.beginTx()) {
            var node = transaction.createNode();
            node.setProperty("a", randomAscii(1024));
            transaction.commit();
        }
    }
    var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnHighIdScan"));
    propertyStore.scanForHighId(cursorContext);
    PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
    assertEquals(1, cursorTracer.hits());
    assertEquals(1, cursorTracer.pins());
    assertEquals(1, cursorTracer.unpins());
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 5 with DefaultPageCacheTracer

use of org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer in project neo4j by neo4j.

the class NeoStoresIT method tracePageCacheAccessOnGetRawRecordData.

@Test
void tracePageCacheAccessOnGetRawRecordData() throws IOException {
    var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    var neoStores = storageEngine.testAccessNeoStores();
    var propertyStore = neoStores.getPropertyStore();
    try (Transaction transaction = db.beginTx()) {
        var node = transaction.createNode();
        node.setProperty("a", "b");
        transaction.commit();
    }
    var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnGetRawRecordData"));
    propertyStore.getRawRecordData(1L, cursorContext);
    PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
    assertEquals(1, cursorTracer.hits());
    assertEquals(1, cursorTracer.pins());
    assertEquals(1, cursorTracer.unpins());
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultPageCacheTracer (org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer)79 Test (org.junit.jupiter.api.Test)66 CursorContext (org.neo4j.io.pagecache.context.CursorContext)49 PageCursorTracer (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer)26 Path (java.nio.file.Path)11 RepeatedTest (org.junit.jupiter.api.RepeatedTest)10 MutableLong (org.apache.commons.lang3.mutable.MutableLong)9 Transaction (org.neo4j.graphdb.Transaction)9 PageCache (org.neo4j.io.pagecache.PageCache)9 Test (org.junit.Test)5 BeforeEach (org.junit.jupiter.api.BeforeEach)5 DelegatingPageCache (org.neo4j.io.pagecache.DelegatingPageCache)5 PagedFile (org.neo4j.io.pagecache.PagedFile)5 Config (org.neo4j.configuration.Config)3 PageCacheTest (org.neo4j.io.pagecache.PageCacheTest)3 PageCursor (org.neo4j.io.pagecache.PageCursor)3 PageCacheStressTest (org.neo4j.io.pagecache.stress.PageCacheStressTest)3 PageCacheTracer (org.neo4j.io.pagecache.tracing.PageCacheTracer)3 DefaultPageCursorTracer (org.neo4j.io.pagecache.tracing.cursor.DefaultPageCursorTracer)3 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)3