Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTS Writes and Reads should use BufferViews #4802

Open
andreipaduroiu opened this issue May 20, 2020 · 1 comment
Open

LTS Writes and Reads should use BufferViews #4802

andreipaduroiu opened this issue May 20, 2020 · 1 comment

Comments

@andreipaduroiu
Copy link
Member

Problem description

  • Storage.write and SyncStorage.write use InputStream as data input.
  • Storage.read and SyncStorage.read expect a heap byte array to be allocated where data from LTS is copied into.

This presents certain drawbacks:

  • On the write side, copying from an InputStream may not be the most efficient way of writing to LTS. For example, there are optimized methods to copy from heap/direct memory into a FileChannel. For S3, there may be better ways than just providing an InputStream and for HDFS, copying from an InputStream into an OutputStream is not too efficient (uses an intermediate buffer).
    • Since the source of the copy is s composition of memory buffers (Netty ByteBufs), we should investigate ways of transferring data directly from these buffers into the LTS API.
  • On the read side, we have a similar situation, however not as bad. But the fact that we need to pre-allocate byte arrays just to read may not make it too efficient.

Problem location
Storage, SyncStorage and implementations.
Call sites of Storage.

Suggestions for an improvement
Add the following APIs and implement them:

  • SyncStorage.write(SegmentHandle handle, long offset, BufferView data) (similar in Storage)
  • BufferView SyncStorage.read(SegmentHandle handle, long offset, int length)
@andreipaduroiu
Copy link
Member Author

cc @RaulGracia

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants