-
Notifications
You must be signed in to change notification settings - Fork 592
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
[CORE-4443] Pandaproxy: Avoid large allocations whilst serializing JSON #20827
[CORE-4443] Pandaproxy: Avoid large allocations whilst serializing JSON #20827
Conversation
Some structures serialize quite large, so in order to avoid oversize allocs, it's necessary to use a buffer type that is not based onn contiguous memmory. Explicitly instantiate all overloads with StringBuffer. Fix the test due to the way name lookup works. Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
101edc0
to
9896a8c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏👏👏 very nice change - I left some questions/suggestions but in general it looks good
Namespace changed due to lookup rules for templates. Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
This reverts commit 313d208. Some edits required to avoid temporaries..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
9896a8c
to
48c43c2
Compare
Changes in [force-push]
|
skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51148#01908333-f923-4e7a-8065-d8a34d3e8741: skipped ducktape retry in https://buildkite.com/redpanda/redpanda/builds/51148#01908333-f8ad-4ce1-971b-7a15bd98bbac: |
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
Signed-off-by: Ben Pope <ben@redpanda.com>
It shouldn't be used in the general case. Signed-off-by: Ben Pope <ben@redpanda.com>
48c43c2
to
ac7c7dd
Compare
Changes in [force-push]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow, this is great
ducktape was retried in https://buildkite.com/redpanda/redpanda/builds/51218#01909289-ddf2-4325-9c74-aa38d3817285 |
/backport v24.1.x |
/backport v23.3.x |
Failed to create a backport PR to v23.3.x branch. I tried:
|
Failed to create a backport PR to v24.1.x branch. I tried:
|
//! Get the length of string in Ch in the string buffer. | ||
size_t GetLength() const { return _impl.size_bytes() / sizeof(Ch); } | ||
|
||
void Reserve(size_t s) { _impl.reserve(s); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenPope what are the semantics of Reserve
? is it like std::vector::reserve
? If so, I don't think you want iobuf:reserve
because it returns an iobuf::placeholder
and increases the size (not the capacity) of the iobuf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenPope what are the semantics of
Reserve
? is it likestd::vector::reserve
? If so, I don't think you wantiobuf:reserve
because it returns aniobuf::placeholder
and increases the size (not the capacity) of the iobuf.
Good spot, thanks.
From post-commit review: redpanda-data#20827 (comment) Signed-off-by: Ben Pope <ben@redpanda.com>
From post-commit review: redpanda-data#20827 (comment) Signed-off-by: Ben Pope <ben@redpanda.com>
From post-commit review: redpanda-data#20827 (comment) Signed-off-by: Ben Pope <ben@redpanda.com>
From post-commit review: redpanda-data#20827 (comment) Signed-off-by: Ben Pope <ben@redpanda.com> (cherry picked from commit d5a6516)
From post-commit review: redpanda-data#20827 (comment) Signed-off-by: Ben Pope <ben@redpanda.com> (cherry picked from commit d5a6516)
Replace use of
::json::StringStream
with a custom stream based oniobuf
to avoid large contiguous allocations.Backports Required
Release Notes
Improvements