Back

Async executions

  • 0
  • Self Hosted
  • Functions
Felipe Amaral
2 Jul, 2024, 19:16

I had a function that made 3 requests to the OpenAI API with 3 different prompts. This function took more than 30 seconds to respond and gave a timeout. So I divided it into 3 functions, each one making a request to the OpenAI API in parallel. However, they still took more than 30 seconds to respond.

@Steven suggested that they be run asynchronously, but this is creating a queue of executions. While one is processed, the other two are waiting.

Is it possible to execute a function asynchronously but without a queue being created?

TL;DR
Developers are experiencing delays in function execution despite using async requests with OpenAI API prompts. Horizontally scaling out function workers may help alleviate this issue. Executing functions asynchronously can still result in a queue formation, but scaling out may improve performance.
Steven
2 Jul, 2024, 19:21

No. Perhaps you need to horizontally scale out your function workers

Felipe Amaral
2 Jul, 2024, 19:27

You are saying that if i execute it sync, making 3 requests to 3 different functions, it runs in parallel. But making the same 3 requests with async option, it creates a queue, and the only way to avoid it is scaling out?

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more