aws-sdk-cpp icon indicating copy to clipboard operation
aws-sdk-cpp copied to clipboard

Kinesis enhanced fanout latency issue.

Open sohaib-rasool opened this issue 1 year ago • 4 comments

Describe the bug

When using aws-sdk-cpp to subscribe to a Kinesis stream with enhanced fanout via the SubscribeToShard() method, the SetEventStreamHandler() callback is invoked with noticeable delays, and data is received in batches instead of real-time. This causes inefficient processing of the stream data, leading to potential performance issues, especially in low-latency or real-time systems.stream data processing

Expected Behavior

  • The SetEventStreamHandler() should be invoked in near real-time as soon as new records are available in the Kinesis stream.
  • Records should be delivered individually or as soon as they are available without being unnecessarily batched or delayed.

Current Behavior

  • The SetEventStreamHandler() callback is delayed and not invoked immediately when new records arrive in the Kinesis shard.
  • Data is accumulated in batches and delivered with noticeable delays rather than being processed as soon as records are produced in the stream.

Reproduction Steps

  • Use aws-sdk-cpp to create a Kinesis enhanced fanout consumer.
  • Set up the SubscribeToShard() method with enhanced fanout and set the event handler using SetEventStreamHandler() to process incoming records.
  • Write a simple record producer that sends data to the Kinesis stream.
  • Observe that the SetEventStreamHandler() callback is invoked with delays and receives records in batches rather than as they become available

Possible Solution

No response

Additional Information/Context

  • The problem persists regardless of the producer's rate of sending records to the stream.
  • Slower the producer, higher the delays are (155 seconds delay if producer sends a single record)
  • Also mentioned in discussion Kinesis enhanced fanout latency issuethe

AWS CPP SDK version used

1.11.389

Compiler and Version used

gcc 11.4.0

Operating System and version

Ubuntu 22.04

sohaib-rasool avatar Sep 20 '24 13:09 sohaib-rasool

Can you provide a minimal reproduction sample that follows the steps you listed above?

jmklix avatar Sep 24 '24 17:09 jmklix

kinesis_EFO_aws_issue.txt image image

I've attached the consumer code. This code does not throw any exception or set any error in subscribeOutcome. Its just that the handler is invoked with significant delay which is explained above. Producer is pretty straightforward which works fine with other consumers.

sohaib-rasool avatar Sep 24 '24 19:09 sohaib-rasool

@jmklix Any updates on this. And do let me know if you need anything else.

sohaib-rasool avatar Sep 30 '24 13:09 sohaib-rasool

Are there any updates on this?

sohaib-rasool avatar Oct 24 '24 10:10 sohaib-rasool

We are still looking into this. We're not entirely sure, but this appears to be an issue with the Kinesis service taking a while to respond rather than a delay caused by the sdk. I will provide more updates here when I find out more info.

jmklix avatar Nov 12 '24 22:11 jmklix

We are working on a PR that might fix this. I will link it here when we have it working

jmklix avatar Dec 17 '24 22:12 jmklix

Fix has been provided via https://github.com/aws/aws-sdk-cpp/pull/3245. Waiting for customer feedback

sbera87 avatar Feb 03 '25 17:02 sbera87

Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Feb 14 '25 00:02 github-actions[bot]

Hello, Thank you for providing the fix, let me confirm and update you here.

sohaib-rasool avatar Mar 04 '25 10:03 sohaib-rasool