I have a function that can handle 30 synchronous requests simultaneously. However, I’ve noticed that the worker function processes these requests sequentially, similar to a single thread handling multiple tasks by serving them partially. This method increases the total execution time and leads to uneven completion times for some calls. On the other hand, if I duplicate the same function across multiple deployments and distribute the calls among them, it could significantly reduce the execution time. In other words, creating multiple threads to handle the calls. However, this would involve duplicating the same function across multiple deployments. Is this second option the better choice?
Is there anything I can do to make the worker function execute as multi-threaded?
I attempted to double the _APP_WORKER_PER_CORE, but it didn’t result in any improvement. Any advice would be appreciated.
How are you executing the function?
Synchronous From the SDK
??
Are you looking for something like this? https://github.com/appwrite/appwrite/issues/1425
I believe my issue is related to this in some ways. My tests were conducted on a function that requires 4 seconds to complete execution for one call. If I execute it 8 times at the same time, it will execute all calls without any delay in the execution time, each taking 4 seconds. However, if I increase the calls to more than 8, it will delay some of them, as I mentioned in my first message (similar to a single thread handling multiple tasks by serving them partially).So Let's consider a scenario where I call it 24 times at the same time. In this case, some executions need 14 seconds to finish and some them need 8 seconds and so on. But, if I duplicate the same function in other deployments, say 3 times, and distribute the calls among them, then each deployed function has to handle 8 calls. In this scenario, there won't be any delay in the call execution.
.
@Nour just wondering: are you using cloud? When I tested this the functions were executing sequentially. So the next execution would wait for the previous one to complete. I'm using self hosted i'm guessing these executions are managed when using cloud.
I’m also using the self-hosted version of Appwrite. Have you figured out the asynchronous flag for execution? It should be set to False for parallel execution and True for sequential executions.
Synchronous shouldn't be blocked like this...what language is your runtime?
How many cores does your server have?
Python 3.11
8 CPUs.
And
The _APP_FUNCTIONS_CPUS is empty, as stated in the Appwrite documentation. When it’s empty, the CPU limit will be disabled.
??
I have been contemplating duplicating a function multiple times and have a routing function that triggers them sequentially basis last triggered time .. Would that approach work ?
Hmm, this is an interesting idea.
Recommended threads
- [SOLVED] Error upgrading from 1.8.1 to 1...
DO Self-hosted server failed to upgrade with this error "Error response from daemon: client version 1.52 is too new. Maximum supported API version is 1.42". U...
- MariaDB refuses to connect to appwrite
Earlier, I tried updating my Appwrite version from 18.1.x to the latest release because my Flutter package required it to function properly. I used the official...
- executeFunction intermittently throws Fo...
Environment: Flutter app using the Appwrite Flutter SDK, calling executeFunction for [describe endpoint, e.g. live-stream-related function]. *Description*: Int...