Search in sources :

Example 1 with DOMStoreReadWriteTransaction

use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction in project controller by opendaylight.

the class AbstractInMemoryDatastoreWriteTransactionBenchmark method write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark.

@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
        writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);
        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
        cohort.canCommit().get();
        cohort.preCommit().get();
        cohort.commit().get();
    }
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort) Measurement(org.openjdk.jmh.annotations.Measurement) Warmup(org.openjdk.jmh.annotations.Warmup) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 2 with DOMStoreReadWriteTransaction

use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction in project controller by opendaylight.

the class AbstractInMemoryDatastoreWriteTransactionBenchmark method write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark.

@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInOneCommitBenchmark() throws Exception {
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
    }
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort) Measurement(org.openjdk.jmh.annotations.Measurement) Warmup(org.openjdk.jmh.annotations.Warmup) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 3 with DOMStoreReadWriteTransaction

use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction in project controller by opendaylight.

the class AbstractInMemoryDatastoreWriteTransactionBenchmark method write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark.

@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write50KSingleNodeWithTwoInnerItemsInCommitPerWriteBenchmark() throws Exception {
    for (int outerListKey = 0; outerListKey < OUTER_LIST_50K; ++outerListKey) {
        DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
        writeTx.write(OUTER_LIST_50K_PATHS[outerListKey], OUTER_LIST_TWO_ITEM_INNER_LIST[outerListKey]);
        DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
        cohort.canCommit().get();
        cohort.preCommit().get();
        cohort.commit().get();
    }
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort) Measurement(org.openjdk.jmh.annotations.Measurement) Warmup(org.openjdk.jmh.annotations.Warmup) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 4 with DOMStoreReadWriteTransaction

use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction in project controller by opendaylight.

the class AbstractInMemoryDatastoreWriteTransactionBenchmark method write100KSingleNodeWithOneInnerItemInOneCommitBenchmark.

@Benchmark
@Warmup(iterations = WARMUP_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
@Measurement(iterations = MEASUREMENT_ITERATIONS, timeUnit = TimeUnit.MILLISECONDS)
public void write100KSingleNodeWithOneInnerItemInOneCommitBenchmark() throws Exception {
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    for (int outerListKey = 0; outerListKey < OUTER_LIST_100K; ++outerListKey) {
        writeTx.write(OUTER_LIST_100K_PATHS[outerListKey], OUTER_LIST_ONE_ITEM_INNER_LIST[outerListKey]);
    }
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort) Measurement(org.openjdk.jmh.annotations.Measurement) Warmup(org.openjdk.jmh.annotations.Warmup) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 5 with DOMStoreReadWriteTransaction

use of org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction in project controller by opendaylight.

the class AbstractInMemoryDatastoreWriteTransactionBenchmark method initTestNode.

protected void initTestNode() throws Exception {
    final YangInstanceIdentifier testPath = YangInstanceIdentifier.builder(BenchmarkModel.TEST_PATH).build();
    DOMStoreReadWriteTransaction writeTx = domStore.newReadWriteTransaction();
    writeTx.write(testPath, provideOuterListNode());
    DOMStoreThreePhaseCommitCohort cohort = writeTx.ready();
    cohort.canCommit().get();
    cohort.preCommit().get();
    cohort.commit().get();
}
Also used : DOMStoreReadWriteTransaction(org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) DOMStoreThreePhaseCommitCohort(org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort)

Aggregations

DOMStoreReadWriteTransaction (org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction)20 Test (org.junit.Test)12 DOMStoreThreePhaseCommitCohort (org.opendaylight.controller.sal.core.spi.data.DOMStoreThreePhaseCommitCohort)12 NormalizedNode (org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode)6 Benchmark (org.openjdk.jmh.annotations.Benchmark)6 Measurement (org.openjdk.jmh.annotations.Measurement)6 Warmup (org.openjdk.jmh.annotations.Warmup)6 DOMStoreReadTransaction (org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction)4 Optional (com.google.common.base.Optional)2 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)2 Ignore (org.junit.Ignore)1 DOMStoreTransactionChain (org.opendaylight.controller.sal.core.spi.data.DOMStoreTransactionChain)1 DOMStoreWriteTransaction (org.opendaylight.controller.sal.core.spi.data.DOMStoreWriteTransaction)1 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)1 NodeIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier)1 ContainerNode (org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)1