Back

performance improvement

  • 0
  • Self Hosted
  • Flutter
  • Functions
Mickaël LT
3 Jul, 2023, 09:23

Hi, We have about 20 beta testers and our mobile app obtain lot of timeout when executing cloud functions. We have 8 Go RAM and 4vCPU. Usually, our cloud function took bout 150/300ms to execute, but something we got timeout when reaching 15s. How to identify the cause ?

TL;DR
The user is experiencing performance issues with their cloud functions on Appwrite. They have already made some improvements to their code but want to identify the bottleneck causing the timeouts. They suspect that rate limiting or slow start of the functions (cold start) may be the issue. The user is advised to check the function timeout settings, increase the timeout if necessary, and analyze the logs to identify which parts of the code are taking the most time. It is also suggested that the user increase concurrency and monitor if that improves performance. No solution is provided in the thread.
42Tom
3 Jul, 2023, 09:47

What does your function look like?

Mickaël LT
3 Jul, 2023, 09:50

We have multiple cloud function, but the main is with about to 20 request in database (read) and calling another function (with async = true)

Meldiron
3 Jul, 2023, 10:49

Hey there 👋 How much concurrency do you do? By default, Appwrite can handle 6 concurrent requests per core. I can imagine things slow down heavily after hitting those limits.

What you can do is to increase function timeout in function settings, and see if that at least successfully finishes the execution. That can be helpful because a successful execution shows logs, and you can use logs to do some timing and see which parts of the code takes the most of the time.

If we see those methods in Appwrite SDK are taking most of the time, I would be pretty confident that we are hitting too many concurrent executions.

Please let me know what you found out and based on that, I can give you suggestion on text steps.

Loic Devaux
3 Jul, 2023, 22:42

I am afraid by your numbers . In this benchmark https://github.com/appwrite/realtime-1-million there were 2000 requests per second. Your server slowing down with 20 users, that s scary. There must be something wrong in the cloud function.

Camo
4 Jul, 2023, 11:38

might you be referring to slow start of the function(cold start)? As the functions run in docker, which has to be started. I've heard there is a setting which can disable the sleep timeout, or make it longer. Dont remember where i've read that though..

Mickaël LT
4 Jul, 2023, 13:05

Yes, actually I've improve the timing for function sleep, improve the timeout of each function, and optimise my cloud function (before, i made lot of small request (20), now I make big request and sort after with custom algo). I've test & hope that is enought 🙂

Loic Devaux
4 Jul, 2023, 13:28

@Mickaël LT do you selfhost appwrite ? If yes I can imagine that the default appwrite stack needs some tweaking maybe.

Mickaël LT
4 Jul, 2023, 13:35

Yes, I've seen some tips to improve the stack for my case, but before this, I want to know where is my bottleneck

Loic Devaux
4 Jul, 2023, 13:45

Could it be appwrite's rate limiting ?

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