redpanda-data / redpanda-data/connect

aws_kinesis input hitting GetRecords API rate limit

Open
#1,209 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bughancement inputs ux
Dominant language
Go
Stars
8.8k
Forks
969
Avg merge
1d 13h
Merged PRs (30d)
64

Description

I have a stream that is getting about 50 messages per second per shard being processed fast enough that benthos is making more than 5 GetRecords calls per second (the AWS per shard rate limit). Despite what the Amazon documentation says, the aws go sdk's GetRecords function does not return a ProvisionedThroughputExceededException error (or any error) when the API rate limit is hit; it just returns 0 records, so this issue is not obvious from the client side but can be seen in the Cloudwatch metrics.

I have tried various permutations of batch periods and sleep durations in the aws_kinesis batch policy, but can't get it to work consistently to reduce the rate limit hit while maintaining throughput.

I believe the aws_kinesis input already does a back off when GetRecords receives zero messages, but in this scenario, the rate limit will already have been hit.

One potential way to handle this is to add a configurable delay before the next GetRecords call, defaulting to no delay as this is not always necessary. Typically, adding a 200 - 250 ms delay should ensure that less than 5 GetRecords API calls are made per second for a shard, assuming we are the only consumer. This would increase latency a little bit but should not impact throughput.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the aws_kinesis input's GetRecords loop and review how its batch policy handles empty responses, backoff, and sleep durations. Add a configurable delay before the next GetRecords call, with no delay as the default, and verify that the setting keeps calls below the per-shard rate limit without reducing throughput.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, go
Domain
cloud, stream-processing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.