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

Chunked encoding for _cat APIs #92022

Conversation

DaveCTurner
Copy link
Contributor

Some of these APIs scale as O(#indices) or O(#shards) so it seems worthwhile to use chunked encoding throughout.

Relates #89838

Some of these APIs scale as O(#indices) or O(#shards) so it seems
worthwhile to use chunked encoding throughout.

Relates elastic#89838
@DaveCTurner DaveCTurner added >non-issue :Distributed/Network Http and internode communication implementations v8.7.0 labels Nov 30, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team label Nov 30, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-distributed (Team:Distributed)

import java.io.OutputStream;
import java.io.Writer;

public final class UTF8StreamWriter extends Writer {
Copy link
Contributor Author

@DaveCTurner DaveCTurner Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This claims performance benefits over the JDK's Writer. It's possible those claims are true, but I don't think this is on a hot enough path to warrant having yet another custom (and wholly untested) implementation of UTF-8 encoding, so I've replaced it with a regular Writer instead.

currentOutput = null;
return new ReleasableBytesReference(chunkOutput.bytes(), () -> Releasables.closeExpectNoException(chunkOutput));
} finally {
if (currentOutput != null) {
Copy link
Contributor Author

@DaveCTurner DaveCTurner Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I don't see any obvious ways to throw exceptions in this area, I'm somewhat dubious about how such an exception would be handled in the networking code (edit: I get it now, but for the sake of safety we have to close currentOutput if we're not returning)

@DaveCTurner
Copy link
Contributor Author

@elasticmachine update branch

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great thanks! Just one question on a test.

Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@DaveCTurner DaveCTurner added the auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) label Dec 6, 2022
@elasticsearchmachine elasticsearchmachine merged commit b3a272e into elastic:main Dec 6, 2022
@DaveCTurner DaveCTurner deleted the 2022-11-30-chunked-encoding-cat-apis branch December 6, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) :Distributed/Network Http and internode communication implementations >non-issue Team:Distributed Meta label for distributed team v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants