Skip to content

Conversation

@jackjlli
Copy link
Member

This PR adds the ability to set the max number of parallel segment downloads per table in pinot-server. There are a couple of reasons:

  • Currently there is no upper limit on how many segment download requests that server can send to controllers. In some cases like table rebalance, if the number of download requests is high, this burst of download requests will affect the availability of pinot controllers to serve other requests.
  • By default there is no timeout on helix state transition. As long as the transition hasn't finished, the segment won't be online for serving queries. Thus, there is no side effect on querying part.

@codecov-commenter
Copy link

codecov-commenter commented May 13, 2022

Codecov Report

Attention: Patch coverage is 23.52941% with 13 lines in your changes missing coverage. Please review.

Project coverage is 69.69%. Comparing base (088da3f) to head (7e6bb56).
Report is 3965 commits behind head on master.

Files with missing lines Patch % Lines
.../pinot/core/data/manager/BaseTableDataManager.java 7.14% 10 Missing and 3 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #8694      +/-   ##
============================================
+ Coverage     66.16%   69.69%   +3.52%     
- Complexity     4387     4575     +188     
============================================
  Files          1277     1722     +445     
  Lines         64430    89862   +25432     
  Branches      10014    13326    +3312     
============================================
+ Hits          42633    62633   +20000     
- Misses        18786    22908    +4122     
- Partials       3011     4321    +1310     
Flag Coverage Δ
integration1 26.99% <23.52%> (?)
integration2 25.35% <23.52%> (?)
unittests1 66.19% <18.75%> (+0.02%) ⬆️
unittests2 14.31% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest doing something similar to SegmentRefreshSemaphore by wrapping the Semaphore inside it or can we just reuse it here since it is reused for both refresh and reload ? May have to change the log message to be more appropriate

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question! Let me explain a bit on why I didn't choose to use the same existing semaphore in this PR:

  • For segment reload, it doesn't have to always download the segment. If the same semaphore is reused, pinot server could lose the ability to download for an actual download request while it's blocked by the same semaphore which is used for reloading a local segment.
  • The default number of segment to be refresh/reload is 1, meaning that for reloading all segments request, there is at most 1 segment to be reloaded, which is also different from the download request.
  • For segment refresh/reload, the target segments are already shown in external view, which means that these segments are already used for querying. While download requests could be made by just adding a segment or table rebalance, during which the EV could not have been converged yet. Thus, it's okay to have higher parallelism for those cases.

Copy link
Contributor

@siddharthteotia siddharthteotia May 13, 2022

Choose a reason for hiding this comment

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

My suggestion was not to reuse the same object/instance (which will be problematic like you mentioned) but the implementation instead and instantiate it here with the required number of permits for download because generically, semaphore just needs those 2 configs and can be instantiated separately by each different user for different purpose.

But this is not super necessary. The current approach is fine

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed. Later on we can improve it to be dynamic instead of a server level config.

@jackjlli jackjlli force-pushed the set-max-parallel-segment-downloads-per-table branch from b915f2e to 6436a9e Compare May 13, 2022 03:55
@jackjlli jackjlli force-pushed the set-max-parallel-segment-downloads-per-table branch from 6436a9e to 7e6bb56 Compare May 13, 2022 04:55
@jackjlli jackjlli merged commit f65b401 into master May 13, 2022
@jackjlli jackjlli deleted the set-max-parallel-segment-downloads-per-table branch May 13, 2022 17:20
@jadami10
Copy link
Contributor

For my understanding, does this feature implicitly lower impact on the servers as well? If we set this and the controller is using the semaphore, does this mean the servers will also be throttled in the rate they download?

For context, I just pushed 4096 segments to a table, and the servers were at 100% CPU for ~30 minutes while it downloaded the segments and finished building indices.

@jackjlli
Copy link
Member Author

For my understanding, does this feature implicitly lower impact on the servers as well? If we set this and the controller is using the semaphore, does this mean the servers will also be throttled in the rate they download?

For context, I just pushed 4096 segments to a table, and the servers were at 100% CPU for ~30 minutes while it downloaded the segments and finished building indices.

@jadami10 Yes, this could be one of the optimizations to lower your CPU usage. While as you mentioned there are two major steps that require servers to handle. For building indices, you can enable the index generation logic during the segment generation so that servers won't be busy doing so. You can enable it in the table config. Take a look at this:
https://github.com/apache/pinot/blob/master/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/creator/SegmentGeneratorConfig.java#L181

@jadami10
Copy link
Contributor

@jadami10 Yes, this could be one of the optimizations to lower your CPU usage
that's great! I'll give this a try next week

For building indices, you can enable the index generation logic during the segment generation so that servers won't be busy doing so. You can enable it in the table config. Take a look at this:
unfortunately it's building a range index and a bloom filter which don't seem to be configurable to be done at segment generation

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.

4 participants