GitHub user merlimat opened a pull request:
https://github.com/apache/bookkeeper/pull/155
Expose ByteBuf in LedgerEntry to avoid data copy
To avoid copying the entries payloads when writing/reading on a ledger and
having to allocate a lot of `byte[]` on the JVM heap, we need to accept Netty
ByteBuf buffer.
By passing a ByteBuf, an application can use a pooled buffer, pointing to
direct memory, to the `LedgerHandle.addEntry()` and have the same buffer
forwarded on the connection sockets to the bookies.
The same thing on the read side, `LedgerEntry` exposes an additional
`getEntryBuffer()` method that can be used to get the underlying buffer and
possibly forward that to some other connection, with zero-copy behavior
(excluding getting data in-out of the kernel).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/merlimat/bookkeeper byte-buf-ledger-entry
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/bookkeeper/pull/155.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #155
----
commit 7859a1a852e4dabc41bc238a6ced54844ddcc62f
Author: Matteo Merli <[email protected]>
Date: 2015-03-24T00:50:33Z
BOOKKEEPER-1068: Expose ByteBuf in LedgerEntry to avoid data copy
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---