Skip to content

Skip unnecessary DescribeStreamConsumer call and sleep for ACTIVE consumers - #1772

Merged
chenylee-aws merged 1 commit into
awslabs:masterfrom
Boxuan996:fix/skip-waitForActive-for-active-consumers
Jun 10, 2026
Merged

chenylee-aws merged 1 commit into
awslabs:masterfrom
Boxuan996:fix/skip-waitForActive-for-active-consumers

Conversation

@Boxuan996

@Boxuan996 Boxuan996 commented Jun 9, 2026 •

Copy link
Copy Markdown
Contributor

FanOutConsumerRegistration.getOrCreateStreamConsumerArn() calls describeStreamConsumer() to get the consumer ARN, but never checks the consumer status from that response. It then unconditionally calls waitForActive() which makes a second describeStreamConsumer() call and sleeps retryBackoffMillis (1s) even when the consumer is already ACTIVE.

For multi-stream EFO applications with many streams, this adds ~1s of unnecessary delay per unique stream during the Scheduler loop, causing significant startup latency (e.g., 160 streams x 1.1s = 176s blocking).

Fix:

  • Check consumer status from the initial describeStreamConsumer() response
  • If already ACTIVE, return immediately (skip waitForActive entirely)
  • In waitForActive loop, break immediately when ACTIVE status detected (prevents sleeping before the while condition is re-evaluated)
  • Log actual consumer status when waiting

Impact: Reduces per-stream consumer ARN lookup from ~1.1s to ~15-20ms for existing ACTIVE consumers (the common case after first registration).

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Boxuan996
Boxuan996 force-pushed the fix/skip-waitForActive-for-active-consumers branch from d22f8a8 to 89f2065 Compare June 9, 2026 22:58
…VE consumers

FanOutConsumerRegistration.getOrCreateStreamConsumerArn() calls
describeStreamConsumer() to get the consumer ARN, but never checks
the consumer status from that response. It then unconditionally calls
waitForActive() which makes a second describeStreamConsumer() call and
sleeps retryBackoffMillis (1s) even when the consumer is already ACTIVE.

For multi-stream EFO applications with many streams, this adds ~1s of
unnecessary delay per unique stream during the Scheduler loop, causing
significant startup latency (e.g., 160 streams x 1.1s = 176s blocking).

Fix:
- Check consumer status from the initial describeStreamConsumer() response
- If already ACTIVE, return immediately (skip waitForActive entirely)
- In waitForActive loop, break immediately when ACTIVE status detected
  (prevents sleeping before the while condition is re-evaluated)
- Log actual consumer status when waiting

Impact: Reduces per-stream consumer ARN lookup from ~1.1s to ~15-20ms
for existing ACTIVE consumers (the common case after first registration).
@Boxuan996
Boxuan996 force-pushed the fix/skip-waitForActive-for-active-consumers branch from 89f2065 to 51cc2de Compare June 9, 2026 23:10
@chenylee-aws
chenylee-aws merged commit ae56b9c into awslabs:master Jun 10, 2026
5 of 6 checks passed
@chenylee-aws chenylee-aws changed the title perf: Skip unnecessary DescribeStreamConsumer call and sleep for ACTI… Skip unnecessary DescribeStreamConsumer call and sleep for ACTIVE consumers Jun 10, 2026
vincentvilo-aws pushed a commit to vincentvilo-aws/amazon-kinesis-client that referenced this pull request Jun 17, 2026

This branch had an error being deployed

1 failed deployment
manual-approval — 51cc2de5 Deployed Jun 9, 2026 by Boxuan996 via wait-for-approval #220
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.

2 participants