python_dynamodb_lock icon indicating copy to clipboard operation
python_dynamodb_lock copied to clipboard

Can multiple clients share the same thread pool?

Open cionz0 opened this issue 4 years ago • 0 comments

  • Python DynamoDB Lock version: 0.9.1
  • Python version: 3.6

Description

This is more a help request than an issue. I'm using this package in an AWS Lambda function and such function has to be really responsive. Since different keys have to be locked by different calls to my function, each time I:

  1. instantiate a client;
  2. request a lock on the desired key;
  3. of course, perform DB operations;
  4. release the lock;
  5. close the client.

The problem is that executing client.close() takes more or less 4 seconds, which is too much for the responsivity constraints I have to fulfill.

So, I was wondering whether I can have a large enough thread pool that I would like to pass as app_callback_executor parameter when instantiating the client so that I wouldn't need invoking client.close(), still avoiding to reach the maximum number of threads allowed for my lambda function (which, indeed, happens if I don't call close()).

Would it be possible?

cionz0 avatar May 19 '20 17:05 cionz0