terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aioboto3 spawning more threads?

VolkrB opened this issue · comments

  • Async AWS SDK for Python version: 10.4.0
  • Python version: 3.9
  • Operating System: WSL2

Description

Implemented aioboto3 upload_fileobj in an async function.

What I Did

I might have a fundamental misconception about how async works, but as far as I understand there should only be one thread at a time (the main event loop) and all async functions including this:

async with sessions.client("s3") as s3:
   await s3.upload_fileobj(file, bucket, file2)

should not spawn any additional threads. However, every aioboto3 functions seems to spawn an additional thread for me. That being said, it still works concurrently. Is there a misconception that I have of how it works or is it maybe a bad implementation? If yes, i will share more code - I have replaced the above code with await asyncio.sleep(1) which does not spawn an additional thread

So at the end of it all there still exists botocore which is patched by aiobotocore and then used by aioboto3. I would hazard a guess theres probably some botocore stuff making some threads. That being said, I wouldn't be too concerned with them as the entire request path is all asyncified.

Cheers Terry and thanks for the quick response & awesome library. Closing