-
Notifications
You must be signed in to change notification settings - Fork 28
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
Improving efficiency of encoding ProduceRequests #104
Comments
I agree that is a problem. Maybe we could store the records as something like:
A while back I had the idea to extend this project to generate 3 separate crates.
This has lots of benefits to performance and ease of use. |
On the decode side, you'd have to pick only one variant to decode into. Perhaps if Avoiding a breaking change would probably mean creating a whole new type. |
we are currently pretty flexible with breaking changes in this project, a bump to 0.15 is not an issue. You make a good point about decoding. Another alternative is to have an alternate decode method on Decodable that decodes as the parsed form. |
More complexity with this is that the compact byte format uses a dynamically-sized header to record the size of the message, and we don't know the size of the bytes we're about to write. I'm not sure if there's a way to reserve enough space for the maximum-size length header, write the records, go back and write the length, then |
Hello!
I'm wondering if there's any way to avoid a double-copy I'm having to do when encoding produce requests. Currently I am creating a new
BytesMut
to pass toRecordBatchEncoder::encode
, then passing that intoPartitionProduceData
. At the tcp sink, those bytes then get encoded again into the sink's internal buffer.However, when this request is going to be sent to the IO sink, it gets encoded into a
FramedWrite
's internal buffer (fromtokio_util
). After encoding, theBytesMut
I made is dropped, and I need to allocate a new one.I'm wondering if there'd be a way to avoid this initial encode step into the intermediate byte array in
PartitionProduceData
, and doRecordBatchEncoder::encode
on the buffer forFramedWrite
, skipping the extra allocation.The text was updated successfully, but these errors were encountered: