Replies: 1 comment 1 reply
-
In general I would recommend you have one AWSClient and one instance of your service type (DynamoDB in your example). In the case of running on a lambda and using environment variables for your credentials the client and service type provide read only configuration data which can be shared across tasks. In answer to your second question when you have 1 core swift-nio creates a single eventloop. You can run multiple requests on the single eventloop. When a request is waiting on a resource eg a response from the network, it is not using the eventloop so the eventloop is free to process other requests. For Soto this means you can be setting up your second, third requests while waiting for the response from your first request. The requests run concurrently but the eventloop is only ever processing one of them at any one time. |
Beta Was this translation helpful? Give feedback.
-
Hi @adam-fowler et al,
To get started with Soto most of the examples I've seen running a lambda to access DynamoDB use a single instantiation of AWSClient and SotoDynamoDB.DynamoDB. I recently changed some code to start making better use of concurrency via async/await and it occurred to me that the original setup might not be optimal.
Thanks in advance for any help with these questions. Soto is a great product and a joy to use.
Beta Was this translation helpful? Give feedback.
All reactions