question

dgupta avatar image
dgupta asked

Cloudscript Execution Time only SOMETIMES too long

Hello,

I need a bit of help. So, recently one of my team members was playing my game, and he ran into an Execution took too long on one of the Cloudscript function. Also, once I was testing and I ran into an Execution took too long on another Cloudscript function.

For the first case, the average execution time is around 0.7 seconds usually, and there is not much random. The max times it can call a playfab server method is 9 times.

For the second case, I don't know the average execution time but it must be very small because it only calls one server method (GetInventory) and then iterates through the inventory to find a specific item.

I cannot seem to replicate the bug, and the game is only in test right now. So, with all this, I have three questions:

1.) I'm in free mode so is it possible that sometimes cloudscripts will take too long because I haven't upgraded my tier yet?

2.) As users increase, will the times of cloudscripts also increase and will I have to account for this?

3.) Do cloudscripts take longer at certain times due to how many people are using playfab or something?

I don't know this bug is confusing me, and I have no idea where to start in testing it or how to improve my code.

Thanks a lot for any help,

Dhruv

CloudScript
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

Sure thing:

1) No, but higher tiers do have longer max runtimes.

2) No.

3) This one's the key - see below.

First, it's important to be aware that the time it takes a Server API call to complete is going to depend upon what all that call needs to do. If it's reading or writing data, the data it's operating on will have a variable amount of time needed to complete, depending on the overall load on the table in question. Usually, that's a fairly small difference, but because of that, you should target no more than 80% of your max Cloud Script execution time for your logic, based on averages you see in your testing (for safety).

Second, if your script hasn't run for a short period of time, it may no longer be loaded. In that case, your script needs to be pulled from storage and loaded on a logic server before it can start. However, the logic managing the time for the script has already started by that time, so there can be a small increase to the total time due to that, as well. In live games, this is rarely the case, since your script likely won't be unloaded (assuming a non-trivial player base).

1 comment
10 |1200

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

dgupta avatar image dgupta commented ·

Oh, I see! Thanks, that is super helpful! :)

0 Likes 0 ·

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.