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

add maxBytesInMemory and maxClientResponseBytes to SamplerConfig #12947

Merged
merged 4 commits into from
Aug 25, 2022

Conversation

clintropolis
Copy link
Member

@clintropolis clintropolis commented Aug 23, 2022

Description

Adds additional limits maxBytesInMemory and maxClientResponseBytes to the Druid sampler API config, to augment existing options of numRows and timeoutMs. While these two configs are quite similar, maxBytesInMemory is oriented around controlling how big the IncrementalIndex which performs the sampling will be, while maxClientResponseBytes is an attempt to allow clients to specify the maximum size of response they would prefer to handle, which might vary significantly from maxBytesInMemory.

maxClientResponseBytes is done in a rather sad way of serializing (and throwing away) the sampler rows and counting the bytes. In the future we might want to rework the sampler API to be a streaming API and do the counting of this stuff and enforcement of limits a bit more naturally.

This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold for code coverage is met.
  • been tested in a test Druid cluster.

@JsonProperty("timeoutMs") Integer timeoutMs
@JsonProperty("numRows") @Nullable Integer numRows,
@JsonProperty("timeoutMs") @Nullable Integer timeoutMs,
@JsonProperty("maxBytesInMemory") @Nullable Long maxBytesInMemory,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@JsonProperty("maxBytesInMemory") @Nullable Long maxBytesInMemory,
@JsonProperty("maxBytesInMemory") @Nullable HumanReadableBytes maxBytesInMemory,

@JsonProperty("numRows") @Nullable Integer numRows,
@JsonProperty("timeoutMs") @Nullable Integer timeoutMs,
@JsonProperty("maxBytesInMemory") @Nullable Long maxBytesInMemory,
@JsonProperty("maxClientResponseBytes") @Nullable Long maxClientResponseBytes
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@JsonProperty("maxClientResponseBytes") @Nullable Long maxClientResponseBytes
@JsonProperty("maxClientResponseBytes") @Nullable HumanReadableBytes maxClientResponseBytes

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, that seems reasonable, forgot about that thing 👍

@@ -253,6 +253,7 @@ public void applyDataSegmentChangeRequests(

final AsyncContext asyncContext = req.startAsync();


asyncContext.addListener(
Copy link
Member

Choose a reason for hiding this comment

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

accidental change?

Copy link
Member

@FrankChen021 FrankChen021 left a comment

Choose a reason for hiding this comment

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

LGTM with minor comments

@clintropolis clintropolis merged commit 8ee8786 into apache:master Aug 25, 2022
@clintropolis clintropolis deleted the sampler-byte-limit branch August 25, 2022 07:50
@abhishekagarwal87 abhishekagarwal87 added this to the 24.0.0 milestone Aug 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants