AWS Kinesis ThrottlingException encountered when making requests to AWS Kinesis.

The request was throttled due to exceeding the allowed request rate.

Understanding AWS Kinesis

AWS Kinesis is a platform on AWS to collect, process, and analyze real-time, streaming data. It allows developers to build applications that can continuously ingest and process large streams of data records in real time. Kinesis is commonly used for real-time analytics, log and event data collection, and processing.

Identifying the Symptom

When working with AWS Kinesis, you might encounter the ThrottlingException. This error typically manifests when your application attempts to make requests at a rate higher than what is allowed by AWS Kinesis.

Common Observations

  • Frequent ThrottlingException errors in your application logs.
  • Increased latency or failure in data processing.
  • Intermittent data loss or delays in data ingestion.

Understanding the ThrottlingException

The ThrottlingException occurs when the rate of requests exceeds the limits set by AWS Kinesis. AWS imposes these limits to ensure fair usage and to maintain the performance and reliability of the service for all users. Each Kinesis stream has a set number of shards, and each shard has its own limits on the number of transactions per second (TPS) and data throughput.

Rate Limits

  • Each shard can support up to 1,000 PUT records per second.
  • The maximum data write rate is 1 MB per second per shard.
  • Read operations are also subject to limits, with each shard supporting up to 5 transactions per second for reads.

Steps to Fix the ThrottlingException

To resolve the ThrottlingException, you need to implement strategies to manage the request rate and ensure it stays within the allowed limits.

Implement Exponential Backoff

Exponential backoff is a common error-handling strategy for network applications in which the client increases the wait time between retries exponentially. This approach helps to reduce the load on the service and increases the chances of successful requests.

try {
// Your AWS Kinesis request logic
} catch (ThrottlingException e) {
// Implement exponential backoff
int retryCount = 0;
int maxRetries = 5;
while (retryCount < maxRetries) {
Thread.sleep((long) Math.pow(2, retryCount) * 1000);
retryCount++;
// Retry the request
}
}

Monitor and Scale Shards

Use AWS CloudWatch to monitor the metrics of your Kinesis stream, such as IncomingBytes and IncomingRecords. If you consistently hit the limits, consider increasing the number of shards in your stream to distribute the load more effectively.

For more information, refer to the AWS Kinesis Monitoring with CloudWatch documentation.

Optimize Data Processing

Review your data processing logic to ensure that it is efficient and that you are not making unnecessary requests. Batch multiple records into a single request where possible to reduce the number of transactions.

Conclusion

By understanding the limits of AWS Kinesis and implementing strategies such as exponential backoff and proper monitoring, you can effectively manage and resolve ThrottlingException errors. For further reading, check out the AWS Kinesis Service Limits documentation.

Never debug

AWS Kinesis

manually again

Let Dr. Droid create custom investigation plans for your infrastructure.

Book Demo
Automate Debugging for
AWS Kinesis
See how Dr. Droid creates investigation plans for your infrastructure.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid