Search in sources :

Example 1 with DiskStoreFactoryImpl

use of org.apache.geode.internal.cache.DiskStoreFactoryImpl in project geode by apache.

the class MultiThreadedOplogPerJUnitPerformanceTest method testPerf.

@Test
public void testPerf() {
    Properties props = new Properties();
    props.setProperty(MCAST_PORT, "0");
    props.setProperty(LOCATORS, "");
    props.setProperty(LOG_LEVEL, "info");
    DistributedSystem ds = DistributedSystem.connect(props);
    Cache cache = null;
    try {
        cache = CacheFactory.create(ds);
    } catch (Exception e) {
        e.printStackTrace();
    }
    DiskStoreFactory dsf = cache.createDiskStoreFactory();
    AttributesFactory factory = new AttributesFactory();
    factory.setPersistBackup(false);
    factory.setScope(Scope.LOCAL);
    factory.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(10, EvictionAction.OVERFLOW_TO_DISK));
    // Properties props1 = new Properties();
    factory.setDiskSynchronous(true);
    dsf.setAutoCompact(false);
    ((DiskStoreFactoryImpl) dsf).setMaxOplogSizeInBytes(200000000);
    dsf.setDiskDirs(dirs);
    factory.setDiskStoreName(dsf.create("perfTestRegion").getName());
    try {
        region = cache.createVMRegion("perfTestRegion", factory.createRegionAttributes());
    } catch (Exception e) {
        e.printStackTrace();
    }
    Thread[] threads = new Thread[numberOfThreads];
    for (int i = 0; i < numberOfThreads; i++) {
        // .start();
        threads[i] = new Thread(new Writer(i));
        threads[i].start();
    }
    for (int i = 0; i < numberOfThreads; i++) {
        ThreadUtils.join(threads[i], 30 * 1000);
    }
    long totalPuts = ((long) numberOfIterations * numberOfKeysPerThread * numberOfThreads);
    System.out.println(" total puts is " + totalPuts);
    System.out.println(" total time in milliseconds is " + totalTime);
    System.out.println(" writes per second is " + (totalPuts * 1000 * numberOfThreads) / (totalTime));
    region.destroyRegion();
}
Also used : DiskStoreFactoryImpl(org.apache.geode.internal.cache.DiskStoreFactoryImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) DistributedSystem(org.apache.geode.distributed.DistributedSystem) Test(org.junit.Test) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Example 2 with DiskStoreFactoryImpl

use of org.apache.geode.internal.cache.DiskStoreFactoryImpl in project geode by apache.

the class PersistentRVVRecoveryDUnitTest method createAsyncRegionWithSmallQueue.

private Region createAsyncRegionWithSmallQueue(final VM vm0) {
    Cache cache = getCache();
    DiskStoreFactoryImpl dsf = (DiskStoreFactoryImpl) cache.createDiskStoreFactory();
    File dir = getDiskDirForVM(vm0);
    dir.mkdirs();
    dsf.setDiskDirs(new File[] { dir });
    dsf.setMaxOplogSizeInBytes(500);
    dsf.setQueueSize(1000);
    dsf.setTimeInterval(1000);
    DiskStore ds = dsf.create(REGION_NAME);
    RegionFactory rf = new RegionFactory();
    rf.setDiskStoreName(ds.getName());
    rf.setDataPolicy(DataPolicy.PERSISTENT_REPLICATE);
    rf.setScope(Scope.DISTRIBUTED_ACK);
    rf.setDiskSynchronous(false);
    Region region = rf.create(REGION_NAME);
    return region;
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) RegionFactory(org.apache.geode.cache.RegionFactory) LocalRegion(org.apache.geode.internal.cache.LocalRegion) PartitionedRegion(org.apache.geode.internal.cache.PartitionedRegion) DiskRegion(org.apache.geode.internal.cache.DiskRegion) Region(org.apache.geode.cache.Region) DiskStoreFactoryImpl(org.apache.geode.internal.cache.DiskStoreFactoryImpl) File(java.io.File) Cache(org.apache.geode.cache.Cache)

Aggregations

DiskStoreFactoryImpl (org.apache.geode.internal.cache.DiskStoreFactoryImpl)2 File (java.io.File)1 Properties (java.util.Properties)1 Cache (org.apache.geode.cache.Cache)1 DiskStore (org.apache.geode.cache.DiskStore)1 Region (org.apache.geode.cache.Region)1 RegionFactory (org.apache.geode.cache.RegionFactory)1 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)1 DistributedSystem (org.apache.geode.distributed.DistributedSystem)1 DiskRegion (org.apache.geode.internal.cache.DiskRegion)1 LocalRegion (org.apache.geode.internal.cache.LocalRegion)1 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 Test (org.junit.Test)1