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

Return ConsumedCapacity in DynamoDBMapper's load(), save() and delete() methods

Open daniil-dubin opened this issue 9 years ago • 4 comments

Information about consumed capacity would be very handy to optimize the load on DB but it's not returned by load(), save() and delete() methods of DynamoDBMapper. Even though underlying AmazonDynamoDBClient provides it, it's simply discarded. We can change

public <T> void delete(...) into public <T> ConsumedCapasity delete()

The question is how to modify load() and save() method's signature so that to enable return of consumed capacity.The alternatives are: an extra wrapper over result (extra GC pressure) or the overloaded version with listener (which is less comfortable to use).

Any ideas what way to follow? Once decided I can contribute.

daniil-dubin avatar May 29 '17 10:05 daniil-dubin

How is the returned ConsumedCapacity used? Is this commonly used feature that requires integration into the SDK?

varunnvs92 avatar May 31 '17 03:05 varunnvs92

ConsumedCapacity contains information about how much of provisioned read/write capacity has been consumed to execute the particular request to dynamodb.

ConsumedCapacity could be used in variety of ways. In particular, I am going to use this data to adjust intensity of requests to DB and maintain the amount of consumed read/write capacity on the near to constant level. This technique allows more control and better load distribution than just making as many request as possible until having them throttled and then doing exponential back-off.

It's been already integrated into SDK namely GetItemResult and UpdateItemResult contain ConsumedCapacity. It's just a problem with DynamoDBMapper that it ignores it.

daniil-dubin avatar Jun 06 '17 10:06 daniil-dubin

We are working on a v2 version of the SDK which we plan to release later this year. We are looking at making major changes in DynamoDBMapper. We can consider this feature request in the new version but we don't have bandwidth to add this feature to current dynamodb mapper. If you can send us a PR, we can certainly look at that.

varunnvs92 avatar Jun 07 '17 19:06 varunnvs92

Hi @daniil-dubin, the SDK team has reviewed the feature request list for V1, and since they're concentrating efforts on V2 new features they decided to not implement this one in V1. It's still being considered for the DynamoDB Mapper refactor in V2, see the referenced issue above. I'll go ahead and close this.

Please feel free to comment on the V2 issue with your use case, and reach out if you have further questions.

debora-ito avatar Jul 22 '19 17:07 debora-ito