Return-Path: X-Original-To: apmail-bookkeeper-user-archive@www.apache.org Delivered-To: apmail-bookkeeper-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 892E6189B7 for ; Mon, 14 Sep 2015 12:03:10 +0000 (UTC) Received: (qmail 2659 invoked by uid 500); 14 Sep 2015 12:03:10 -0000 Delivered-To: apmail-bookkeeper-user-archive@bookkeeper.apache.org Received: (qmail 2610 invoked by uid 500); 14 Sep 2015 12:03:10 -0000 Mailing-List: contact user-help@bookkeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@bookkeeper.apache.org Delivered-To: mailing list user@bookkeeper.apache.org Received: (qmail 2600 invoked by uid 99); 14 Sep 2015 12:03:10 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Sep 2015 12:03:10 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 006131A1980 for ; Mon, 14 Sep 2015 12:03:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.995 X-Spam-Level: ** X-Spam-Status: No, score=2.995 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=3, RP_MATCHES_RCVD=-0.006, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-east.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id CRkxo-HTGxYs for ; Mon, 14 Sep 2015 12:02:57 +0000 (UTC) Received: from mail.diennea.com (mail.diennea.com [151.99.189.40]) by mx1-us-east.apache.org (ASF Mail Server at mx1-us-east.apache.org) with ESMTPS id 02D1344569 for ; Mon, 14 Sep 2015 12:02:56 +0000 (UTC) Received: from DNAEXC01.diennea.lan ([192.168.2.40]) by dnaexc01.diennea.lan ([192.168.2.40]) with mapi; Mon, 14 Sep 2015 14:02:48 +0200 From: Enrico Olivelli - Diennea To: "user@bookkeeper.apache.org" Date: Mon, 14 Sep 2015 14:02:46 +0200 Subject: Fastest way to write to bookkeeper Thread-Topic: Fastest way to write to bookkeeper Thread-Index: AdDu37kUrY5/TTfbTxeGZxMLCMNL6w== Message-ID: Accept-Language: it-IT Content-Language: it-IT X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: it-IT Content-Type: multipart/alternative; boundary="_000_ADD972C51196844491C410BCD4146DCD84859AE932dnaexc01dienn_" MIME-Version: 1.0 --_000_ADD972C51196844491C410BCD4146DCD84859AE932dnaexc01dienn_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 res=3D new ArrayList<>(); // holds entry sequence numbers CountDownLatch latch =3D new CountDownLatch(size); for (int i =3D 0; i < size; i++) { ..... this.out.asyncAddEntry(entry, new AsyncCallback.AddCallback() { public void addComplete(int rc, LedgerHandle lh, long entryId, Object i= ) { int index =3D (Integer) i; if (rc !=3D BKException.Code.OK) { BKException error =3D BKException.create(rc= ); exception.value =3D error; res.set(index, null); for (int j =3D 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 refact= or Can I file an issue in order to implement a "batchAddEntries" which impleme= nts 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 Diennea - Digital Marketing Solutions http://www.diennea.com ________________________________ Iscriviti alla nostra newsletter per rimanere aggiornato su digital ed emai= l marketing! http://www.magnews.it/newsletter/ --_000_ADD972C51196844491C410BCD4146DCD84859AE932dnaexc01dienn_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi,

What is the fastest way to writ= e to BookKeeper a batch of entries ?

 

I’m using a sequence of a= syncAddEntry, some thing like the code below:

 

List<Long> res=3D new Arr= ayList<>(); // holds entry sequence numbers

CountDownLatch latch =3D new Co= untDownLatch(size);

for (int i =3D 0; i < size; = i++) {

…..

   this.out.asyncAddE= ntry(entry, new AsyncCallback.AddCallback() {

 

    public void = addComplete(int rc, LedgerHandle lh, long entryId, Object i) {

     &= nbsp;           &nbs= p;          int index =3D (Int= eger) i;

     &= nbsp;           &nbs= p;          if (rc !=3D BKExce= ption.Code.OK) {

     &= nbsp;           &nbs= p;            &= nbsp; BKException error =3D BKException.create(rc);

     &= nbsp;           &nbs= p;            &= nbsp; exception.value =3D error;

     &= nbsp;           &nbs= p;            &= nbsp; res.set(index, null);

     &= nbsp;           &nbs= p;            &= nbsp; for (int j =3D 0; j < size; j++) {

     &= nbsp;           &nbs= p;            &= nbsp;     // early exit

     &= nbsp;           &nbs= p;            &= nbsp;     latch.countDown();

     &= nbsp;            &nb= sp;            =  }

     &= nbsp;           &nbs= p;          } else {

     &= nbsp;           &nbs= p;            &= nbsp; res.set(index, entryId);

     &= nbsp;           &nbs= p;            &= nbsp; latch.countDown();

     &= nbsp;           &nbs= p;          }

     &= nbsp;           &nbs= p;      }

     &= nbsp;           &nbs= p;  }, 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 Olivell= i
Software Development Manager @Die= nnea
Tel.: (+39) 0546&nbs= p;066100 - Int. 925
Viale G.Marconi 30/14 - 48018 Faen= za (RA)

MagNews - E-mail Marketing Solutio= ns
http://www= .magnews.it
Diennea - Digital Marketing Solutions
http://ww= w.diennea.com

 



Iscriviti alla nostra newsl= etter per rimanere aggiornato su digital ed email marketing! http://www.mag= news.it/newsletter/
--_000_ADD972C51196844491C410BCD4146DCD84859AE932dnaexc01dienn_--