Menu
×
   ❮   
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

AWS Serverless Error Handling for Stream-Based Events


Error Handling for Stream-Based Events

Stream-based event sources must keep record order consistent across shards.

Stream-based event sources could be Kinesis Data Streams or DynamoDB Streams.

If Lambda encounters an issue while processing a batch of data, it will stop processing new data.

A batch of data is a large amount of data.

To discover blocked shards, you can use the Iterator-Age metric.

It measures the age of the stream records your function recently processed.


Failure Management

By using four configuration options, you can manage failures better:

  • Bisect batch on function error
  • Maximum retry attempts
  • Maximum record age
  • On-failure destination

If a function error occurs, Lambda will split the batch in half and resume each half separately.

Maximum retry attempts and maximum record age limit the number of retries on a failed batch.

An on-failure destination allows you to send failed records for offline processing.


Error Handling For Stream-Based Events Video

W3schools.com collaborates with Amazon Web Services to deliver digital training content to our students.


How Error Handling for Stream-Based Events Works

When a function produces an error, Lambda divides the batch in half (Bisect batch).

Lambda delivers each half to your function individually, keeping record order.

When Lambda divides a batch, it also resets the retry and max-age parameters.

Lambda will keep dividing the batches until it finds the bad record.

Lambda will keep trying to send the bad record according to the maximum retry attempts.

Lambda will send it to the SNS topic defined for the on-failure destination if it continues to fail.

After removing the erroring record, Lambda goes back through each of the smaller batches it made.

The downside of this process is that some records could be processed multiple times.

It is also called idempotency.

Idempotency must be managed by you.


AWS Serverless Exercises

Test Yourself With Exercises

Exercise:

What is idempotency?

Processing same  multiple times

Start the Exercise


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.