如何解决 dynamodb 的吞吐量错误? [英] How to solve throughput error for dynamodb?

查看:19
本文介绍了如何解决 dynamodb 的吞吐量错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Traceback(控制台的最后输出):

Traceback (the last output from console):

File "batchpy.py", line 61, in <module>
obj.batch_w1()
File "batchpy.py", line 49, in batch_w1
batch.put_item(data=item)
File "/usr/local/lib/python2.7/dist-packages/boto/dynamodb2/table.py",   line 1641, in __exit__
self.resend_unprocessed()
File "/usr/local/lib/python2.7/dist-packages/boto/dynamodb2/table.py", line 1718, in resend_unprocessed
resp = self.table.connection.batch_write_item(batch_data)
File "/usr/local/lib/python2.7/dist-packages/boto/dynamodb2/layer1.py", line 420, in batch_write_item
body=json.dumps(params))
File "/usr/local/lib/python2.7/dist-packages/boto/dynamodb2/layer1.py", line 2842, in make_request
retry_handler=self._retry_handler)
File "/usr/local/lib/python2.7/dist-packages/boto/connection.py", line 954, in _mexe
status = retry_handler(response, i, next_sleep)
File "/usr/local/lib/python2.7/dist-packages/boto/dynamodb2/layer1.py", line 2876, in _retry_handler
response.status, response.reason, data)
boto.dynamodb2.exceptions.ProvisionedThroughputExceededException:    ProvisionedThroughputExceededException: 400 Bad Request
{u'message': u'The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API', u'__type': u'com.amazonaws.dynamodb.v20120810#ProvisionedThroughputExceededException'}

推荐答案

有两种方法可以解决这个问题:

There are 2 ways you can handle this problem:

  1. 提高吞吐量(对于此选项,您必须支付更多费用).

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

通常我们在某些时候必须做的事情是我们需要在应用程序级别实现逻辑.例如,调用 dynamoDB 来检查异常.如果超过吞吐量,请休眠几秒钟并再次调用相同的查询(这是我们在应用中实现的).

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).

这篇关于如何解决 dynamodb 的吞吐量错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆