use of org.nustaq.kontraktor.Actors in project kontraktor by RuedigerMoeller.
the class Basic method testTableSpace.
@Test
public void testTableSpace() {
TableSpaceActor ts = Actors.AsActor(TableSpaceActor.class);
ts.init();
ts.createOrLoadTable(new TableDescription("blogs").numEntries(500_000).storageType(TableDescription.StorageType.TEMP).sizeMB(500)).await();
ts.createOrLoadTable(new TableDescription("articles").numEntries(500_000 * 10).storageType(TableDescription.StorageType.TEMP).sizeMB(500 * 10)).await();
RealLiveTable blogs = ts.getTableAsync("blogs").await();
RealLiveTable articles = ts.getTableAsync("articles").await();
int numBP = 30_000;
for (int i = 0; i < numBP; i++) {
MapRecord blogEntry = MapRecord.New("blog" + i);
blogEntry.put("title", "Java is beautiful").put("description", "High performance Java, realtime distributed computing, other stuff").put("tags", "#tech #java #distributed #actors #concurrency #webcomponents #realtime").put("author", "R.Moeller").put("likes", 199).put("reads", 3485).put("sequence", i);
blogs.addRecord(blogEntry);
}
System.out.println("finished blogs");
for (int i = 0; i < numBP * 10; i++) {
MapRecord article = MapRecord.New("art" + i);
// article
// .putRecord("title", "WebComponents BLabla")
// .putRecord("description", "High performance Java, realtime distributed computing, other stuff")
// .putRecord("tags", "#tech #java #distributed #actors #concurrency #webcomponents #realtime")
// .putRecord("author", "R.Moeller")
// .putRecord("likes", 199)
// .putRecord("reads", 3485)
// .putRecord("blog", "blog"+i)
// .putRecord("date", new Date() );
article.put("tags", new String[] { "#tech", "#java2", "#distributed", "#actors", "#concurrency", "#webcomponents", "#realtime" }).put("likes", 199).put("reads", 3485).put("blog", "blog" + i).put("date", System.currentTimeMillis());
articles.addRecord(article);
}
System.out.println("finished articles");
// while( true )
{
long tim = System.currentTimeMillis();
AtomicInteger counter = new AtomicInteger(0);
blogs.forEachWithSpore(new FilterSpore(record -> record.getKey().indexOf("99") >= 0).setForEach((r, e) -> {
}));
blogs.ping().await();
System.out.println("time blo " + (System.currentTimeMillis() - tim));
System.out.println("hits:" + counter.get());
counter.set(0);
tim = System.currentTimeMillis();
articles.forEachWithSpore(new FilterSpore(record -> record.getKey().indexOf("999") >= 0).setForEach((r, e) -> {
}));
articles.ping().await();
System.out.println("time art " + (System.currentTimeMillis() - tim));
System.out.println("hits:" + counter.get());
}
// ts.shutDown();
}
Aggregations