Skip to content

Use chunked encoding for RestGetSettingsAction#90326

Merged
original-brownbear merged 1 commit intoelastic:mainfrom
original-brownbear:chunked-get-settings
Sep 27, 2022
Merged

Use chunked encoding for RestGetSettingsAction#90326
original-brownbear merged 1 commit intoelastic:mainfrom
original-brownbear:chunked-get-settings

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

This one needs chunked encoding as well, the response easily grows to O(10M) for large deployments with many indices. Especially when settings are numerous or have large values like e.g. settings from the Beats templates.

relates #89838

This one needs chunked encoding as well, the response easily grows to O(10M)
for large deployments with many indices. Especially when settings are numerous or
have large values like e.g. settings from the Beats templates.
@original-brownbear original-brownbear added >non-issue :Distributed/Network Http and internode communication implementations v8.6.0 labels Sep 24, 2022
@elasticsearchmachine elasticsearchmachine added the Team:Distributed Meta label for distributed team. label Sep 24, 2022
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

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

Copy link
Copy Markdown
Contributor

@henningandersen henningandersen left a comment

Choose a reason for hiding this comment

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

LGTM.

I'd sort of prefer that we ensured not to implement ToXContent now, rather than later. This PR would (I think) need additional changes to accomodate that change. And as such we are building up debt that we'd need to tackle in the future rather than in individual PRs like this one.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
XContentBuilder builder = new XContentBuilder(JsonXContent.jsonXContent, baos);
toXContent(builder, ToXContent.EMPTY_PARAMS, false);
var iterator = toXContentChunked(false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If we think this can grow to 10M+, should we then not avoid assembling this fully here, i.e., limit the output to say 100 entries?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point, not entirely trivial to do that, would have to add more logic to achieve that. I wonder if it matters all that much, we have the same problem for the other large responses as well.

I'll try to address this in the next PR on this while dropping the toXContent from these objects also. Incoming :)

@original-brownbear
Copy link
Copy Markdown
Contributor Author

Thanks Henning! It's hard to drop toXContent from this one in isolation, it'll be easiest to fix this one off now across all implementations.
It's the next PR on the chunked response front promise :)

@original-brownbear original-brownbear merged commit 2a66741 into elastic:main Sep 27, 2022
@original-brownbear original-brownbear deleted the chunked-get-settings branch September 27, 2022 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Network Http and internode communication implementations >non-issue Team:Distributed Meta label for distributed team. v8.6.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants