question

visualizervr avatar image
visualizervr asked

CloudScript execution time includes server warmup

I find that it is an extremely common occurrence that my CloudScript functions will exceed the time limit when they haven't run in some time. That is clearly because the first time they are run, they are loaded onto the server which takes some time. Subsequent calls run faster because of this.

Since CloudScript functions only allow a very small amount time before they timeout (5 - 10 seconds), I find it a little unfair that the time it takes to load them onto the server is counted towards the timeout limit. It makes it such that I need to rely on retry logic everywhere that a cloud function is called on my front-end.

Does anyone else have this issue and is there some general advice about this?

Thanks in advance.

CloudScriptlimits
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

If your script is running at close to the time limit under normal circumstances, it's highly recommended that you trim the time required. In general with servers, you should only be targeting around 80% of the theoretical max, for safety's sake. In the case of Cloud Script, for any game with a non-trivial player base, you should find that your scripts remain loaded most of the time, but it is always the case that there could be a condition that results in the script not being loaded on a logic server (or needing another logic server, if load is growing for your title), which will cause the script to have an incremental startup time.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.