Search in sources :

Example 6 with Benchmark

use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.

the class CrossVersionSelectAllVsSelectKeysBenchmarkTest method testSelectAll.

@Test
public void testSelectAll() {
    Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {

        @Override
        public void action() {
            client.select(records);
        }
    };
    long elapsed = benchmark.run();
    record("select all", elapsed);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Example 7 with Benchmark

use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.

the class CrossVersionWriteBenchmarkTest method testWrite.

@Test
public void testWrite() {
    Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {

        @Override
        public void action() {
            for (int i = 0; i < 10000; ++i) {
                client.add("foo", Time.now(), i);
            }
        }
    };
    double avg = benchmark.run(10) / 10;
    record("write", avg);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Example 8 with Benchmark

use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.

the class CrossVersionReadBenchmarkTest method testRead.

@Test
public void testRead() {
    Benchmark benchmark = new Benchmark(TimeUnit.MILLISECONDS) {

        @Override
        public void action() {
            client.select("foo < " + Time.now());
        }
    };
    double avg = benchmark.run(10) / 10;
    record("read", avg);
}
Also used : Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Example 9 with Benchmark

use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.

the class DatabaseTest method testGatherVsSelectBenchmark.

@Test
public void testGatherVsSelectBenchmark() {
    java.util.Random rand = new java.util.Random();
    Database store = (Database) this.store;
    List<Long> records = Lists.newArrayList();
    for (int i = 0; i < TestData.getScaleCount() * 100; ++i) {
        records.add(Time.now());
    }
    List<String> keys = Lists.newArrayList();
    for (int i = 0; i < TestData.getScaleCount() * 10; ++i) {
        keys.add(Random.getSimpleString());
    }
    for (int i = 0; i < TestData.getScaleCount(); ++i) {
        String key = keys.get(rand.nextInt(keys.size()));
        long record = records.get(rand.nextInt(records.size()));
        TObject value = Convert.javaToThrift(Random.getObject());
        add(key, value, record);
        if (rand.nextInt() % 6 == 0) {
            remove(key, value, record);
        }
    }
    Database $store = store;
    Benchmark select = new Benchmark(TimeUnit.MILLISECONDS) {

        @Override
        public void action() {
            for (long record : records) {
                for (String key : keys) {
                    $store.select(key, record);
                }
            }
        }
    };
    Benchmark gather = new Benchmark(TimeUnit.MILLISECONDS) {

        @Override
        public void action() {
            for (long record : records) {
                for (String key : keys) {
                    $store.gather(key, record);
                }
            }
        }
    };
    double selectTime = select.run(1);
    double gatherTime = gather.run(1);
    System.out.println("Select took " + selectTime + " ms and gather took " + gatherTime + " ms");
    Assert.assertTrue(gatherTime <= selectTime);
}
Also used : TObject(com.cinchapi.concourse.thrift.TObject) Random(com.cinchapi.concourse.util.Random) Benchmark(com.cinchapi.common.profile.Benchmark) StoreTest(com.cinchapi.concourse.server.storage.StoreTest) Test(org.junit.Test)

Example 10 with Benchmark

use of com.cinchapi.common.profile.Benchmark in project concourse by cinchapi.

the class StoresTest method testBenchmarkSelectKeyRecordsOptionalAtomicWithNavigation.

@Test
public void testBenchmarkSelectKeyRecordsOptionalAtomicWithNavigation() {
    AtomicSupport store = getStore();
    setupNavigationGraph(store);
    // @formatter:off
    List<String> keys = ImmutableList.of("job.title");
    // @formatter:on
    Benchmark serial = new Benchmark(TimeUnit.MICROSECONDS) {

        @Override
        public void action() {
            Stores.serialSelect(store, keys.get(0), 1);
        }
    };
    Benchmark bulk = new Benchmark(TimeUnit.MICROSECONDS) {

        @Override
        public void action() {
            Stores.select(store, keys, 1);
        }
    };
    double serialTime = serial.average(5);
    double bulkTime = bulk.average(5);
    System.out.println("single navigation serial = " + serialTime);
    System.out.println("single navigation BULK = " + bulkTime);
}
Also used : AtomicSupport(com.cinchapi.concourse.server.storage.AtomicSupport) Benchmark(com.cinchapi.common.profile.Benchmark) Test(org.junit.Test)

Aggregations

Benchmark (com.cinchapi.common.profile.Benchmark)23 Test (org.junit.Test)23 AtomicSupport (com.cinchapi.concourse.server.storage.AtomicSupport)4 TObject (com.cinchapi.concourse.thrift.TObject)2 CountUpLatch (com.cinchapi.common.concurrent.CountUpLatch)1 CsvImporter (com.cinchapi.concourse.importer.CsvImporter)1 Importer (com.cinchapi.concourse.importer.Importer)1 Value (com.cinchapi.concourse.server.model.Value)1 LazyTrackingTObjectResultDataset (com.cinchapi.concourse.server.plugin.data.LazyTrackingTObjectResultDataset)1 StoreTest (com.cinchapi.concourse.server.storage.StoreTest)1 ClientServerTest (com.cinchapi.concourse.test.ClientServerTest)1 ConcourseBaseTest (com.cinchapi.concourse.test.ConcourseBaseTest)1 Random (com.cinchapi.concourse.util.Random)1 AtomicDouble (com.google.common.util.concurrent.AtomicDouble)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ByteBuffer (java.nio.ByteBuffer)1 Path (java.nio.file.Path)1 Map (java.util.Map)1 Set (java.util.Set)1 CountDownLatch (java.util.concurrent.CountDownLatch)1