-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Asyncio for pynamodb #968
base: master
Are you sure you want to change the base?
Asyncio for pynamodb #968
Conversation
Thanks for picking this up! I think the only way this can be mergeable is to separate out the async functionality as an optional extra. This would require some refactoring of connection-related parts to separate the current botocore sync implementation from the new aiobotocore async one.
I wouldn't expect asyncio to be inherently faster than another form of cooperative multitasking. That said, can you share the code you're using to benchmark? There are many variables such as the python version, event loop implementation, etc. to account for. I might guess that |
Update: I tried with a remote dynamodb and it doesn't look like it's a matter of the the local dynamodb being overloaded. |
I don't have a good benchmark unfortunately, I'm just trying to hammer my FastAPI server with requests. One version is using this async version, and another is using a sync implementation (and normal pynamo). I'd have expected the number of concurrent requests it can handle to increase dramatically due to the networking code happening in parallel. Though I'm getting roughly the same results. |
OK, one last update: it looks like it's CPU bound indeed. Most of the time is spent between |
Adding asyncio support to pynamodb.
This makes #853 redundant.
I haven't properly tested everything, but my code seems to work. Notes:
_async
suffix I gave others. This is easy to fix.Would love to get your thoughts on why things may not be as performant as I thought they would/should be.
CC @svix-yair, @ikonst, @garrettheel