Skip to content

Improve Kinesis consumer throttling handling#18531

Merged
KKcorps merged 1 commit into
apache:masterfrom
KKcorps:kinesis-rate-limit-fix
May 22, 2026
Merged

Improve Kinesis consumer throttling handling#18531
KKcorps merged 1 commit into
apache:masterfrom
KKcorps:kinesis-rate-limit-fix

Conversation

@KKcorps
Copy link
Copy Markdown
Contributor

@KKcorps KKcorps commented May 19, 2026

Summary

  • Add a shared per-JVM Kinesis request limiter keyed by stream, shard, and AWS read operation.
  • Add bounded backoff/retry handling for Kinesis ProvisionedThroughputExceededException from GetRecords and GetShardIterator.
  • Allow fractional requests_per_second_limit values so deployments can divide shard read budget across Pinot replicas/tables and other consumers.

Why

AWS throttling occurs before Pinot's post-fetch realtime consumption limiters run. When Kinesis rejects GetRecords, Pinot currently logs the throttle and returns an empty batch immediately, which can keep the consumer in a no-progress polling loop. Moving the control into the Kinesis consumer gives Pinot a way to coordinate local read pressure and back off before surfacing a no-progress batch.

Configuration

Config Default Change Impact
requests_per_second_limit 1.0 Existing key now accepts decimal values such as 0.25 Operators can split the AWS shard read budget across replicas, tables, and non-Pinot consumers without changing the config key.

Reviewer Notes

  • GetRecords retries reuse the existing shard iterator instead of repeatedly calling GetShardIterator after a read throttle.
  • Timeout exhaustion still returns an empty non-EOP batch at the original offset, preserving the existing no-progress contract without falsely ending the shard.

@KKcorps KKcorps marked this pull request as ready for review May 19, 2026 11:11
@KKcorps KKcorps force-pushed the kinesis-rate-limit-fix branch 2 times, most recently from e75565b to f9406c9 Compare May 19, 2026 12:12
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2026

Codecov Report

❌ Patch coverage is 78.44828% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.27%. Comparing base (a986489) to head (c34ce4e).
⚠️ Report is 24 commits behind head on master.

Files with missing lines Patch % Lines
...e/pinot/plugin/stream/kinesis/KinesisConsumer.java 79.04% 15 Missing and 7 partials ⚠️
...che/pinot/plugin/stream/kinesis/KinesisConfig.java 72.72% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #18531      +/-   ##
============================================
+ Coverage     63.72%   64.27%   +0.54%     
+ Complexity     1932     1136     -796     
============================================
  Files          3292     3311      +19     
  Lines        201471   203916    +2445     
  Branches      31317    31730     +413     
============================================
+ Hits         128392   131066    +2674     
+ Misses        62796    62339     -457     
- Partials      10283    10511     +228     
Flag Coverage Δ
custom-integration1 100.00% <ø> (ø)
integration 100.00% <ø> (ø)
integration1 100.00% <ø> (ø)
integration2 0.00% <ø> (ø)
java-21 64.27% <78.44%> (+0.54%) ⬆️
temurin 64.27% <78.44%> (+0.54%) ⬆️
unittests 64.27% <78.44%> (+0.54%) ⬆️
unittests1 56.72% <ø> (+0.96%) ⬆️
unittests2 35.52% <78.44%> (+0.26%) ⬆️

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.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@KKcorps KKcorps requested a review from noob-se7en May 20, 2026 04:39
Copy link
Copy Markdown
Contributor

@xiangfu0 xiangfu0 left a comment

Choose a reason for hiding this comment

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

Found one high-signal issue; see inline comment.

Kinesis GetRecords and GetShardIterator throttling happens before Pinot's post-fetch consumption limiters can help, so the consumer now coordinates per-JVM request rate, supports fractional RPS configuration, and backs off boundedly on AWS throttle responses before returning a no-progress batch.
@KKcorps KKcorps force-pushed the kinesis-rate-limit-fix branch from f9406c9 to c34ce4e Compare May 21, 2026 17:29
@KKcorps KKcorps merged commit fb32b30 into apache:master May 22, 2026
11 checks passed
@xiangfu0
Copy link
Copy Markdown
Contributor

Docs PR: pinot-contrib/pinot-docs#820

xiangfu0 added a commit to pinot-contrib/pinot-docs that referenced this pull request May 22, 2026
## Summary

Documents the Kinesis throttling behavior change from
[apache/pinot#18531](apache/pinot#18531).

## Changes

- update the Kinesis ingestion guide for fractional
`requests_per_second_limit` values
- document the shared read-rate limiter and bounded retry behavior
- correct the Kinesis connector reference defaults to match the shipped
source

## Validation

- cross-checked against the local `apache/pinot` Kinesis connector
source
- ran `git diff --check`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants