I have a python runtime function that is making API calls to 3-4 external services, and the slowest of them can take about 15 seconds to respond.
This function can be called through the frontend quite often (I can have hundreds of simultaneous calls)
To simulate, I added a simple time.sleep(15) to a test function, and called this function execution x num of times in parallel.
Looks like the function cannot handle more than 4 (amount of cores in my instance) requests. i.e. at a time only 4 requests can be executed, which means the cores are tied up when this call is made, which is expected.
However, apparently I can't use await asyncio.sleep because python worker definition is not async.
This is quite different from node runtime. I added a sleep function there, and due to the nature of node event loop, it allowed me to execute 100 functions at once.
Looking for suggestions on how to improve this number in python runtime.
Recommended threads
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...
- Use different email hosts for different ...
Hello, I have 2 projects and i want to be able to set up email templates in the projects. Both projects will have different email host configurations. I see ...
- Migrate from cloud to localhost
Hello everyone. I need to migrate my test project from cloud to localhost, however it seems that this is possible only if a self-hosted appwrite instance it's h...