Akavall / GoGamesProject

Trying to make some simple games using golang.
1 stars 1 forks source link

Game gets slow, looks like provisioned throughput issue #57

Closed Akavall closed 7 years ago

Akavall commented 7 years ago

After first couple of games, games become really slow.

There is actually an error message:

2017/08/04 02:43:48 Was not able to put GameState in DynamoDB ProvisionedThroughputExceededException: The level of configured provisioned throughput for the table was exceeded. Consider increasing your provisioning level with the UpdateTable API. status code: 400, request id: HTMED2KN7OPCK5F22SQ2MGC3RVVV4KQNSO5AEMVJF66Q9ASUAAJG 2017/08/04 02:43:52 Put/update GameState associated with dd200718-15ed-4ddb-4d86-ed794b58a414 in DynamoDB table: GameStates

Look like a simple fix, but would rather explore a little bit before just increasing throughput.

Akavall commented 7 years ago

Your request rate is too high. The AWS SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests and use exponential backoff. For more information, go to Error Retries and Exponential Backoff in the Amazon DynamoDB Developer Guide.

http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/dynamodbv2/model/ProvisionedThroughputExceededException.html

I increased Read and write capacity units from 1 to 3 for both, and the problem seems to went away.

a-temlyakov commented 7 years ago

1 read and write should be enough... that really just means 1 r/w per second:

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ProvisionedThroughput.html

Are we calling it in a loop somewhere?

Akavall commented 7 years ago

We read and write as fast as we click on "Take Turn" or "AI Turn". I am pretty sure there isn't anything else. But it is not hard to click faster than once per second (in a normal game flow, not randomly clicking really fast), and then it pauses for couple of seconds to catch up.