-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forwarder): handle records concurrently (#226)
Copying large objects can take a while when executing across regions. This commit ensures we handle each SQS record concurrently, which should be safe since: - `s3:CopyObject` does not consume lambda resources, so we are not at risk of running out of memory / cpu - our fan out factor is capped by our batch size on the SQS queue, which is quite small when compared to the AWS API limits. Each SQS record itself may contain a list of files to copy. This list is still processed serially for now. In practice we do not use this capability yet.
- Loading branch information
Showing
7 changed files
with
196 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
{ | ||
"Records": [ | ||
{ | ||
"messageId": "6aa4e980-26f6-46f4-bb73-fa6e82257191", | ||
"receiptHandle": "AQEBdiYF/uR3IpR5MARpzj0ELM7jWFWuuRoei5gup23IMOTSOT8tJB+i3yTl7oykC/UGx7S8bVs+oFkYi8oeK8SANvAYzudqi7WjrXpJMaQfHhebNemzKsBGQg/NRPSOUc+s12APZAp/6r/uGH2K8dBeQuXCD4j2x8w3356cUJ6Iy/sVUvY+KzxP6x7poz+89nQOqFS6g7JS5KVRlDlEpyAdrVGD9kaDI47gQ49A/SlbSwDCBP3AekiyY2gzI4sbPRdhAO0GMpSiNENKcBCgEcaJD6uh7QwnD+NcdF7IO5XktokrKdG7OeoHgKFNQ06nWZDTzxZTLJrk2sEK+Ta5objqGWCRd0PhTMlZNXRd5aEmYimd+1zLBciY1H/yOzUkVQ0cXYmSJ7q8VYk5goF+FBlUXEeImPXbD+E8p4yOtFp7QIRBzmPm3so7onJGXr7g5++I", | ||
"body": "{\"Records\":[{\"eventVersion\":\"2.1\",\"eventSource\":\"aws:s3\",\"awsRegion\":\"us-west-2\",\"eventTime\":\"2023-09-19T03:49:59.565Z\",\"eventName\":\"ObjectCreated:Put\",\"userIdentity\":{\"principalId\":\"AWS:AIDA2YN7JF3XJWA6ZRUAE\"},\"requestParameters\":{\"sourceIPAddress\":\"192.184.182.96\"},\"responseElements\":{\"x-amz-request-id\":\"2PSYP94SQN8SDTJE\",\"x-amz-id-2\":\"uL6hVdR9zmVu2Alc0ZXeqnUiHq80WZsEmBj98oY2SX6r5T4Kc3NE6RKn9VjbiQAXGDZ5dKKPp++u+K7mSYJNI/Ai/aW5E5at\"},\"s3\":{\"s3SchemaVersion\":\"1.0\",\"configurationId\":\"tf-s3-queue-20230829163550234000000002\",\"bucket\":{\"name\":\"observeinc-filedrop-hoho-us-west-2-7xmjt\",\"ownerIdentity\":{\"principalId\":\"A21JCN1A8EHLG1\"},\"arn\":\"arn:aws:s3:::observeinc-filedrop-hoho-us-west-2-7xmjt\"},\"object\":{\"key\":\"ds101/test3.json\",\"size\":16,\"eTag\":\"ed818579e8cee1d812a77f19efa5e56a\",\"versionId\":\"gv3S8Vnq7asERIoRjci5ssZkjTCjbVjY\",\"sequencer\":\"0065091A67786DA574\"}}}]}", | ||
"attributes": { | ||
"ApproximateReceiveCount": "3", | ||
"SentTimestamp": "1695095400530", | ||
"SenderId": "AIDAJFWZWTE5KRAMGW5A2", | ||
"ApproximateFirstReceiveTimestamp": "1695095400531" | ||
}, | ||
"messageAttributes": {}, | ||
"md5OfMessageAttributes": null, | ||
"md5OfBody": "b0a876f5ce4a6e24a1ea1db02ea02bd3", | ||
"eventSource": "aws:sqs", | ||
"eventSourceARN": "arn:aws:sqs:us-west-2:739672403694:observeinc-filedrop-hoho-us-west-2-7xmjt", | ||
"awsRegion": "us-west-2" | ||
} | ||
] | ||
"Records": [ | ||
{ | ||
"messageId": "6aa4e980-26f6-46f4-bb73-fa6e82257191", | ||
"receiptHandle": "AQEBdiYF/uR3IpR5MARpzj0ELM7jWFWuuRoei5gup23IMOTSOT8tJB+i3yTl7oykC/UGx7S8bVs+oFkYi8oeK8SANvAYzudqi7WjrXpJMaQfHhebNemzKsBGQg/NRPSOUc+s12APZAp/6r/uGH2K8dBeQuXCD4j2x8w3356cUJ6Iy/sVUvY+KzxP6x7poz+89nQOqFS6g7JS5KVRlDlEpyAdrVGD9kaDI47gQ49A/SlbSwDCBP3AekiyY2gzI4sbPRdhAO0GMpSiNENKcBCgEcaJD6uh7QwnD+NcdF7IO5XktokrKdG7OeoHgKFNQ06nWZDTzxZTLJrk2sEK+Ta5objqGWCRd0PhTMlZNXRd5aEmYimd+1zLBciY1H/yOzUkVQ0cXYmSJ7q8VYk5goF+FBlUXEeImPXbD+E8p4yOtFp7QIRBzmPm3so7onJGXr7g5++I", | ||
"body": "{\"Records\":[{\"eventVersion\":\"2.1\",\"eventSource\":\"aws:s3\",\"awsRegion\":\"us-west-2\",\"eventTime\":\"2023-09-19T03:49:59.565Z\",\"eventName\":\"ObjectCreated:Put\",\"userIdentity\":{\"principalId\":\"AWS:AIDA2YN7JF3XJWA6ZRUAE\"},\"requestParameters\":{\"sourceIPAddress\":\"192.184.182.96\"},\"responseElements\":{\"x-amz-request-id\":\"2PSYP94SQN8SDTJE\",\"x-amz-id-2\":\"uL6hVdR9zmVu2Alc0ZXeqnUiHq80WZsEmBj98oY2SX6r5T4Kc3NE6RKn9VjbiQAXGDZ5dKKPp++u+K7mSYJNI/Ai/aW5E5at\"},\"s3\":{\"s3SchemaVersion\":\"1.0\",\"configurationId\":\"tf-s3-queue-20230829163550234000000002\",\"bucket\":{\"name\":\"observeinc-filedrop-hoho-us-west-2-7xmjt\",\"ownerIdentity\":{\"principalId\":\"A21JCN1A8EHLG1\"},\"arn\":\"arn:aws:s3:::observeinc-filedrop-hoho-us-west-2-7xmjt\"},\"object\":{\"key\":\"ds101/test3.json\",\"size\":16,\"eTag\":\"ed818579e8cee1d812a77f19efa5e56a\",\"versionId\":\"gv3S8Vnq7asERIoRjci5ssZkjTCjbVjY\",\"sequencer\":\"0065091A67786DA574\"}}}]}", | ||
"attributes": { | ||
"ApproximateReceiveCount": "3", | ||
"SentTimestamp": "1695095400530", | ||
"SenderId": "AIDAJFWZWTE5KRAMGW5A2", | ||
"ApproximateFirstReceiveTimestamp": "1695095400531" | ||
}, | ||
"messageAttributes": {}, | ||
"md5OfMessageAttributes": null, | ||
"md5OfBody": "b0a876f5ce4a6e24a1ea1db02ea02bd3", | ||
"eventSource": "aws:sqs", | ||
"eventSourceARN": "arn:aws:sqs:us-west-2:739672403694:observeinc-filedrop-hoho-us-west-2-7xmjt", | ||
"awsRegion": "us-west-2" | ||
} | ||
] | ||
} |
Oops, something went wrong.