-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DynamoDB Streams lag monitoring #5
Comments
This feature is currently on DynamoDB's road map, but they don't currently have an ETA. |
Put the System.timeInMillis() in an item attribute on your own when you put and update items. As long as your stream view type is NEW_IMAGES or OLD_AND_NEW_IMAGES and your item updates contain this timestamp, you can get a better approximation. |
@amcp I'm afraid adding an item attribute does not solve this issue. I think this one should be reopened. The requirement here is for lag a metric. This means the time (in millis) between the current item, and the latest item that was added to the stream. From the docs for MillisBehindLatest:
If no new items are added, the client is not lagging (even if the time attribute on the item is old). This is very different to checking a time attribute on the item. |
Seems to me you are interested in the age of stream records relative to the tip of each shard. Each processor works on a shard forward in time. Each time you do a GetRecords call on your usual shard iterator, you could also get a shard iterator for that shard of type LATEST and compute the lag you seek in that manner. Note that shards can roll over for size and age or split for throughput reasons so you might have to do a few calls to get to the latest child shard. By sampling the tip of each shard lineage, you could keep a pretty good estimate of how much you lag. |
Here is some good related reading (also includes links to prior articles). |
Another measure of lag is the number of records between the current set of records and the tip. It would be good if this library implemented some help with either kind of lag monitoring. |
Together with the lag estimates above you could also use 1 minute CloudWatch ConsumedCapacity metrics on the table to estimate the number of writes accepted per second, allowing you to backtrack the number of records between your Stream Worker and the heads of offspring shard lineages. |
Another thing you could do is feed the DynamoDB Stream into a Kinesis stream with a Lambda, and use the MillisBehindLatest metric from Kinesis records. Seems a bit over the top though. |
Any updates on that? Is there any other way to identify how long particular event sits in the stream? |
The value of We're currently working on emitting a The DynamoDB Streams |
@aggarwal this is great to know I was just looking at this information. https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_StreamRecord.html |
Version 1.5.3 now includes the implementation of https://github.com/awslabs/dynamodb-streams-kinesis-adapter/releases/tag/1.5.3 |
Hi @aggarwal, Or is it only for the Kinesis streams? |
Hello!
We're using DynamoDB Streams + Kinesis Client Library (KCL).
How can we measure latency between event was created in a stream and it was processed on KCL side?
As I know, KCL's
MillisBehindLatest
metric is specific to Kinesis Streams.approximateCreationDateTime
record attribute has a minute-level approximation, which is not acceptable for monitoring in sub-second latency systems.Could you please help with some useful metrics for monitoringDynamoDB Streams latency?
Thank you!
Ivan
The text was updated successfully, but these errors were encountered: