Skip to content

Reduce metadata IO during segment allocation#17496

Merged
kfaraz merged 5 commits intoapache:masterfrom
kfaraz:reduce_segalloc_metadata_io
Nov 26, 2024
Merged

Reduce metadata IO during segment allocation#17496
kfaraz merged 5 commits intoapache:masterfrom
kfaraz:reduce_segalloc_metadata_io

Conversation

@kfaraz
Copy link
Copy Markdown
Contributor

@kfaraz kfaraz commented Nov 21, 2024

Revives #17420

Description

The changes here try to reduce metadata IO during segment allocation by fetching segment payloads
for only the required segments. For other segments, only fetching the segment ID suffices.

Changes

  • Add Overlord runtime property druid.indexer.tasklock.batchAllocationReduceMetadataIO.
  • Setting this flag to true (default value) allows the Overlord to fetch only necessary segment payloads during segment allocation
  • Settings this flag to false restores original segment allocation behaviour

Release note

Add Overlord runtime property druid.indexer.tasklock.batchAllocationReduceMetadataIO.
Setting this flag to true (default value) allows the Overlord to fetch only necessary segment payloads during segment allocation.


This PR has:

  • been self-reviewed.
  • added documentation for new or modified features or behaviors.
  • a release note entry in the PR description.
  • added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
  • added or updated version, license, or notice information in licenses.yaml
  • 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.
  • added integration tests.
  • been tested in a test Druid cluster.

private long batchAllocationWaitTime = 0L;

@JsonProperty
private boolean batchAllocationReduceMetadataIO = 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.

Should this be always on and then we remove this config in next release ?

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.

Yeah, I guess the changes are safe enough. We can always keep it on. Let me try to run ITs with it turned on.

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.

Flag has been set to true by default.

@kfaraz
Copy link
Copy Markdown
Contributor Author

kfaraz commented Nov 26, 2024

Thanks for the reviews, @AmatyaAvadhanula , @cryptoe !
Taking a final look at the PR, then I will merge the changes.

@kfaraz kfaraz merged commit 207ad16 into apache:master Nov 26, 2024
@kfaraz kfaraz deleted the reduce_segalloc_metadata_io branch November 26, 2024 06:10
= versionIntervalToSmallestSegmentId.computeIfAbsent(segmentId.getVersion(), v -> new HashMap<>());
final SegmentId value = map.get(segmentId.getInterval());
if (value == null || value.getPartitionNum() > segmentId.getPartitionNum()) {
map.put(interval, segmentId);
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.

I think the key here should be segmentId.getInterval() not interval. @kfaraz does that sound right to you?

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.

Yes, thanks a lot for catching this, @gianm !

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.

6 participants