Hi,
What is the fastest way to write to BookKeeper a batch of entries ?
I'm using a sequence of asyncAddEntry, some thing like the code below:
List<Long> res= new ArrayList<>(); // holds entry sequence numbers
CountDownLatch latch = new CountDownLatch(size);
for (int i = 0; i < size; i++) {
.....
this.out.asyncAddEntry(entry, new AsyncCallback.AddCallback() {
public void addComplete(int rc, LedgerHandle lh, long entryId, Object i) {
int index = (Integer) i;
if (rc != BKException.Code.OK) {
BKException error = BKException.create(rc);
exception.value = error;
res.set(index, null);
for (int j = 0; j < size; j++) {
// early exit
latch.countDown();
}
} else {
res.set(index, entryId);
latch.countDown();
}
}
}, i);
}
latch.await();
Would it be faster to group all the entries in one "large" entry ? This may
alter application semantics but if it would be faster I will do the refactor
Can I file an issue in order to implement a "batchAddEntries" which implements
the write of a batch of entries within the native Bookkeeper client ?
Enrico Olivelli
Software Development Manager @Diennea
Tel.: (+39) 0546 066100 - Int. 925
Viale G.Marconi 30/14 - 48018 Faenza (RA)
MagNews - E-mail Marketing Solutions
http://www.magnews.it<http://www.magnews.it/>
Diennea - Digital Marketing Solutions
http://www.diennea.com<http://www.diennea.com/>
________________________________
Iscriviti alla nostra newsletter per rimanere aggiornato su digital ed email
marketing! http://www.magnews.it/newsletter/