You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m running the API operation BatchWriteItem inside a for-loop where I read a JSON file line-by-line. The table has the Write Throughput Unit set to 3.
// data is a variable filled by reading a JSON filescanner:=scanner.NewScanner(data)
forscanner.Scan() {
data=scanner.Bytes()
// Unmarshal the data to Golang struct// convert the data to a DynamoDB item
log.Println(“Makingarequest…”)
// where bwi is a BatchWriteInput structif_, err:=client.BatchWriteItem(context.TODO, &bwi); err!=nil {
returnfmt.Errorf(err)
}
}
The problem with such code snippet is that it fails to upload even when the batch has two only items. The error I get is that it exceeds the maximum throughput.
The most interesting part is the output I get:
Making a request…
Making a request…
Making a request…
Making a request…
Making a request…
Making a request…
Making a request…
ProvisionedThroughputExceededException
The following output for a blocking method does not have much sense. I would have expected to block waiting for the BatchWriteItem request to return.
My only guess is that API operations are async but I couldn’t find any evidence in the code.
For the sake of completeness, I might add that the size of each item read from the JSON file is about ~6KB.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I’m running the API operation
BatchWriteItem
inside a for-loop where I read a JSON file line-by-line. The table has the Write Throughput Unit set to 3.The problem with such code snippet is that it fails to upload even when the batch has two only items. The error I get is that it exceeds the maximum throughput.
The most interesting part is the output I get:
The following output for a blocking method does not have much sense. I would have expected to block waiting for the
BatchWriteItem
request to return.My only guess is that API operations are async but I couldn’t find any evidence in the code.
For the sake of completeness, I might add that the size of each item read from the JSON file is about ~6KB.
Beta Was this translation helpful? Give feedback.
All reactions