use of org.apache.geode.internal.cache.snapshot.SnapshotPacket.SnapshotRecord in project geode by apache.
the class GFSnapshotJUnitPerformanceTest method testCopyPerformance.
@Test
public void testCopyPerformance() throws IOException, ClassNotFoundException {
int count = 100000;
for (int i = 0; i < 10; i++) {
writeFile(count, val);
File tmp = File.createTempFile("snapshot-copy", null);
tmp.deleteOnExit();
final SnapshotWriter writer = GFSnapshot.create(tmp, "test");
long start = System.currentTimeMillis();
SnapshotIterator<Integer, String> iter = GFSnapshot.read(f);
try {
while (iter.hasNext()) {
Entry<Integer, String> entry = iter.next();
writer.snapshotEntry(new SnapshotRecord(null, entry));
}
writer.snapshotComplete();
long elapsed = System.currentTimeMillis() - start;
double rate = 1.0 * count / elapsed;
System.out.println("rate = " + rate + " entries / ms");
} finally {
iter.close();
}
}
}
use of org.apache.geode.internal.cache.snapshot.SnapshotPacket.SnapshotRecord in project geode by apache.
the class GFSnapshotJUnitPerformanceTest method testWritePerformance.
@Test
public void testWritePerformance() throws IOException {
int j = 0;
while (j++ < 10) {
long start = System.currentTimeMillis();
int count = 100000;
String s = val;
SnapshotWriter ss = GFSnapshot.create(f, "test");
try {
for (int i = 0; i < count; i++) {
ss.snapshotEntry(new SnapshotRecord(i, s));
}
} finally {
ss.snapshotComplete();
}
long elapsed = System.currentTimeMillis() - start;
double rate = 1000.0 * count / elapsed;
System.out.println(rate + " write operations / sec");
}
}
use of org.apache.geode.internal.cache.snapshot.SnapshotPacket.SnapshotRecord in project geode by apache.
the class GFSnapshotJUnitPerformanceTest method testStreamReadPerformance.
@Test
public void testStreamReadPerformance() throws IOException, ClassNotFoundException {
writeFile(100000, val);
int i = 0;
while (i++ < 10) {
long start = System.currentTimeMillis();
int count = 0;
GFSnapshotImporter in = new GFSnapshotImporter(f);
SnapshotRecord entry;
while ((entry = in.readSnapshotRecord()) != null) {
count++;
}
in.close();
long elapsed = System.currentTimeMillis() - start;
double rate = 1000.0 * count / elapsed;
System.out.println(rate + " stream read operations / sec");
}
}
Aggregations