Back

[SOLVED] Function execution duration

  • 0
  • Functions
Farg0
14 Sep, 2023, 14:12

What determines the function execution duration? Appwrite 1.4.2 is a self-hosted Runtime: Dart (dart-3.0) The first execution is 2-3 seconds. Two series of 3 executions. Is the problem in bad hardware, or should it be?

TL;DR
There was an issue with function execution duration in Appwrite. The solution was to change the timeout threshold in the `.env` file. The default threshold was 15 seconds, but it can be changed to any desired value (e.g. 3600 seconds). To implement the change, reload Docker using the command `docker compose down && docker compose up -d`. The function container can be checked using the command `docker ps -a`. The problem was not related to bad hardware.
Binyamin
14 Sep, 2023, 14:14

What is your function threshold timeout? The first one should take a bit more as it starting up the server.

Farg0
14 Sep, 2023, 14:16

function threshold timeout - default 15 sec.

Binyamin
14 Sep, 2023, 14:17

Than if it was on the exact hour time, then it might be shut down

Binyamin
14 Sep, 2023, 14:17

Can you check the results of

TypeScript
docker ps -a

To see how long the function container is running?

Farg0
14 Sep, 2023, 14:20

"worker-functions" 26 hours ago Up 26 hours 80/tcp

Binyamin
14 Sep, 2023, 14:21

It should be something with the function ID as is name

Binyamin
14 Sep, 2023, 14:21

You mean timeout or threshold? You set the threshold in the .env file

Farg0
14 Sep, 2023, 14:22

60

Binyamin
14 Sep, 2023, 14:27

So that's is 60 seconds

Meaning if your function is inactive for 60 seconds it will get shut down and will have a cold boot (which is 2-3 seconds) in your case before starting.

Change that number to 3600 for example to make it shut down any inactive function after one hour. Remember to reload your docker

TypeScript
docker compose down && docker compose up -d
Binyamin
14 Sep, 2023, 14:27

And let us know if you still experience the long 2-3 seconds execution time.

Farg0
14 Sep, 2023, 14:28
TypeScript
Binyamin
14 Sep, 2023, 14:28

Yes

Binyamin
14 Sep, 2023, 14:28

That make sense As you can see is brand new (just 8 seconds) and that is because it was shut down after 15 seconds of being inactive

Farg0
14 Sep, 2023, 14:30

thank you i understand can be closed👍

Drake
14 Sep, 2023, 20:49

btw, there's a bug that will be fixed in 1.4.3 where the runtime containers were being removed way too soon. see https://github.com/appwrite/appwrite/pull/6235

Farg0
15 Sep, 2023, 07:16

In my case, changing the threshold timeout helped.

Drake
15 Sep, 2023, 16:45

[SOLVED] Function execution duration

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