Skip to content
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

feat: add exponential backoff retry for ProvisionedThroughputExceeded / ThrottlingException / InternalServerError #196

Merged
merged 1 commit into from
May 9, 2024

Conversation

yoshidan
Copy link
Contributor

@yoshidan yoshidan commented Feb 21, 2024

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

add exponential backoff retry for ProvisionedThroughputExceeded / ThrottlingException / InternalServerError

Issue #, if available:
#195

Description of changes:

Added the configuration to retry batch_write_item_api.

Configuration

Since retry_batch_write_item is optional, it can be undefined.
In this case, no retry is performed.

dy config dump

---
tables: ~

---
using_region: ~
using_table: ~
using_port: ~
retry: ~
---
tables: ~

---
using_region: ~
using_table: ~
using_port: ~
retry:
  default:
    initial_backoff: ~
    max_backoff:
      secs: 10
      nanos: 0
    max_attempts: 20
  batch_write_item: ~

Execution Logs

Output retry logs with warn level.

ProvisionedThroughputExceeded

9675 items processed (7.86 items/sec)[2024-02-20T06:49:02Z WARN  dy::batch] Retry batch_write_item : The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.
[2024-02-20T06:49:12Z WARN  dy::batch] Retry batch_write_item : The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.
9950 items processed (154.91 items/sec)[2024-02-20T06:49:34Z WARN  dy::batch] Retry batch_write_item : The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.
[2024-02-20T06:49:44Z WARN  dy::batch] Retry batch_write_item : The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API.
10000 items processed (7.89 items/sec)

ThrottlingException

375 items processed (13.29 items/sec)[2024-02-27T00:51:18Z WARN  dy::batch] Retry batch_write_item : Request ID: Some("O3R1LLIR8E56GL9UA5N37HEV53VV4KQNSO5AEMVJF66Q9ASUAAJG") Body: {"__type":"com.amazon.coral.availability#ThrottlingException","message":"Throughput exceeds the current capacity of your table or index. DynamoDB is automatically scaling your table or index so please try again shortly. If exceptions persist, check if you have a hot key: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html"}
700 items processed (13.95 items/sec)[2024-02-27T00:51:54Z WARN  dy::batch] Retry batch_write_item : Request ID: Some("8TCT72BODCGFIKBVILA25P369RVV4KQNSO5AEMVJF66Q9ASUAAJG") Body: {"__type":"com.amazon.coral.availability#ThrottlingException","message":"Throughput exceeds the current capacity of your table or index. DynamoDB is automatically scaling your table or index so please try again shortly. If exceptions persist, check if you have a hot key: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html"}
750 items processed (8.45 items/sec)[2024-02-27T00:52:08Z WARN  dy::batch] Retry batch_write_item : Request ID: Some("5E6T40L360OAF6P4MFEE2S0RINVV4KQNSO5AEMVJF66Q9ASUAAJG") Body: {"__type":"com.amazon.coral.availability#ThrottlingException","message":"Throughput exceeds the current capacity of your table or index. DynamoDB is automatically scaling your table or index so please try again shortly. If exceptions persist, check if you have a hot key: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html"}

@yoshidan yoshidan changed the title feat: add exponential backoff retry for ProvisionedThroughputExceeded feat: add exponential backoff retry for ProvisionedThroughputExceeded / ThrottlingException / InternalServerError Feb 27, 2024
@StoneDot StoneDot self-requested a review March 1, 2024 14:11
Copy link
Contributor

@StoneDot StoneDot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the delayed response.

First, thank you for bringing the excellent improvement to dynein. As you mentioned in the issue, exponential backoff enhances stability for batch writing. I am willing to merge this pull request. However, I would like to request some modifications because we need to maintain compatibility after the migration to AWS SDK for Rust, which is currently in progress.

I have left some comments requesting modifications. Could you please review these comments?

src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
@StoneDot StoneDot added the enhancement New feature or request label Mar 1, 2024
@yoshidan
Copy link
Contributor Author

@StoneDot We have corrected the problem and would appreciate it if you could check again.

src/app.rs Outdated Show resolved Hide resolved
src/app.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@StoneDot StoneDot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing my comments. I appreciate your effort.

To merge this PR, we need a minor modification to pass the test and a change to maintain compatibility with Backon and AWS SDK. Also, please remember to squash these changes into a single commit after the review. It helps us track the change quickly.

The change of test code is required because we changed the structure of the configuration file. See the test code.

I believe it is pretty close to merging this.

@StoneDot
Copy link
Contributor

I'm sorry for forgetting to mention this. You need to include the following message in the summary of the pull request.

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

@StoneDot
Copy link
Contributor

StoneDot commented May 9, 2024

@yoshidan Hello. I eagerly await your return so I can merge the pull request. I'm looking forward to moving forward with this. If you have any technical issues, please don't hesitate to let me know. I will assist you in completing the review process and merging this pull request.

--
もし英語でのコミュニケーションで細かい話をすることが難しい場合は、日本語でもかまわないのでご共有いただけると幸いです。もし記録として残しておくと有用そうな内容がある場合は、私の方で英訳を残しておくこともできるかと思います。

@yoshidan yoshidan requested a review from a team as a code owner May 9, 2024 02:04
Signed-off-by: yoshidan <naohiro.y@gmail.com>
src/app.rs Show resolved Hide resolved
@yoshidan
Copy link
Contributor Author

yoshidan commented May 9, 2024

@StoneDot Sorry for the late response. Now I fixed the code. Please review again.

Copy link
Contributor

@StoneDot StoneDot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for your quick response and fix. I know everyone has many things to do and is busy, so please do not mind it.

All things seem excellent to me. Thank you for contributing it. I will approve this and merge it.

@StoneDot StoneDot merged commit 4a12ecc into awslabs:main May 9, 2024
4 of 5 checks passed
KIrie-0217 pushed a commit to KIrie-0217/dynein that referenced this pull request May 15, 2024
Signed-off-by: yoshidan <naohiro.y@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants