How to solve throughput error for dynamodb?

前端 未结 2 619
悲&欢浪女
悲&欢浪女 2020-12-30 01:27

Traceback (the last output from console):

File \"batchpy.py\", line 61, in 
obj.batch_w1()
File \"batchpy.py\", line 49, in batch_w1
batch.put_         


        
相关标签:
2条回答
  • 2020-12-30 02:01

    There are 2 ways you can handle this problem:

    1. Increase level of throughput (for this option you have to pay more).

    2. The way that normally we have to do at some points is that we need to implement the logic at application level. For instance, call dynamoDB to check for an exception. If throughput is exceeded, sleep for some seconds and call the same query again (this is what we have implemented in our app).

    0 讨论(0)
  • 2020-12-30 02:10

    DynamoDB uses a provisioned throughput model for both reads and writes. That means your application will receive errors if it tries to perform more reads or writes than you have allocated to the table.

    AWS has done a number of things to help out with this:

    • The AWS SDK clients will automatically retry the request several times before you see a ProvisionedThroughputExceededException
    • Up to five minutes of unused capacity can be consumed in bursts to accommodate spikes in requests
    • You can increase the provisioned read/writes on a table an unlimited number of times each day (to perform more reads/writes per second)
    • You can decrease the provisioned throughput on a table 9 times a day (4 times in the first 4 hours, and 1 each in the rest 4 hours window) (to save money)
    • You can use Dynamic DynamoDB, a 3rd party app, to automatically manage scaling up and down the provisioned throughput

    Depending on the type of app you are creating there are several things you can do to deal with these errors:

    • Batch or long running applications can back-off and retry these requests if they occur to limit the table usage
    • When bulk loading or bulk reading from a table you can manually scale up the throughput and scale down after you are done
    • For a transactional application you can ensure you have your provisioned throughput above the level required to run the application
    • Use Dynamic DynamoDB or script changes to table throughput yourself
    0 讨论(0)
提交回复
热议问题