Skip to main content
1 de 3

Can several functions in parallel write data in dynamo db?

execution without parallel functions: time = x

execution with 4 parallel functions: time = x / 4

When the code attached with 4 parallel functions is executed, the total time is not divided for 4, but is maintained.

my question is: Does Dynamodb support parallel function table writes?

def patronfanin_out(event, context):
    for i in range(4):
        response = lambda_client.invoke(
        FunctionName="tesis-aws-patrones-dev-workers",
        InvocationType='Event',
        Payload=json.dumps(x)
      )

def workers(event, context):
  table = boto3.resource('dynamodb').Table('patron2')
  rowsFinal = event['list']
  for row in rowsFinal:
    table.put_item(Item={
        'id': str(uuid.uuid4()),
        'serie': row[0],
        'rank': row[1],
        'discipline': row[2],
        'sex': row[3],
        'salary': row[4]
        })
  response = {
      "statusCode": 200,
      "params" : rowsFinal
  }
  return response