Hi, Firstly we need some more details about your environment. Are the bookies (bookkeeper servers) configured on separate machines? Is each bookie configured to use a separate disk for the journalDirectory and ledgersDirectory?
Also, you are writing using the synchronous api (#addEntry). This means that you cannot start to write an entry until the previous one has completed. If it takes 10ms to hit the disk, the max you will see is 100 writes per second (of course this is higher than what you have, but check the other things first). Regards Ivan On 17 October 2014 09:38, sky_c...@163.com <sky_c...@163.com> wrote: > hi, > I have tried bookkeeper-4.3.0 today. But its write speed is 4 entries > per sec in my environment. > There are 5 bookkeeper-server-4.3.0 in my env. > Is there anything wrong? Test codes as follows: > public void syncWriteLedger(long write_num) throws InterruptedException, > BKException { > byte[] pwd = "foobar".getBytes(); > LedgerHandle lh = client.createLedger(3, 2, > DigestType.MAC, pwd); > > long ledgerId = lh.getId(); > System.out.println("ledgerId=" + ledgerId); > System.out > .println("data_len=" > + ("Hello World!afdafdafdfxtyb457u8n9,7.,pbesgcerfqx" + write_num) > .getBytes().length); > byte[] data = ("Hello World!afdafdafdfxtyb457u8n9,7.,pbesgcerfqx" + > write_num).getBytes(); > long st = System.currentTimeMillis(); > for (int i = 0; i < write_num; i++) { > lh.addEntry(data); > } > long ut = System.currentTimeMillis() - st; > lh.close(); > double uts = StringUtil.div(ut, 1000, 3); > double wspeed = StringUtil.div(write_num, uts, 2); > System.out.println("ut=" + ut + " ms, write_num=" + write_num > + ", write speed=" + wspeed + "/s"); > > > LedgerHandle lh2 = client.openLedger(ledgerId, BookKeeper.DigestType.MAC, > pwd); > long lastEntry = lh2.getLastAddConfirmed(); > st = System.currentTimeMillis(); > Enumeration<LedgerEntry> entries = lh2.readEntries(0, lastEntry); > while (entries.hasMoreElements()) { > byte[] bytes = entries.nextElement().getEntry(); > System.out.println(new String(bytes)); > } > ut = System.currentTimeMillis() - st; > lh2.close(); > uts = StringUtil.div(ut, 1000, 3); > double rspeed = StringUtil.div(write_num, uts, 2); > System.out.println("ut=" + ut + " ms, read_num=" + write_num > + ", read speed=" + rspeed + "/s"); > > } > ________________________________ > sky_c...@163.com