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();
}
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;
}
Aggregations