question

omerkhalid avatar image
omerkhalid asked

Response time exceeding 1000ms

Hi everybody. I hope you are having a good day. I am measuring the response time of the api and every call is around 1200,1300ms atleast which of course isn't good enough. And these are simple api call from the client api.

I am on free tier right now. Any help about this will much appreciated

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.

omerkhalid avatar image omerkhalid commented ·

Additional details: I have started making calls to playfab after two weeks and the call frequency is very sparse i.e 4,5 calls in a minute.

Ideally i would like to bring this under a 200,300 milliseconds. This big response time is really infeasible.

0 Likes 0 ·
Rick Chen avatar image
Rick Chen answered

Sorry for the late reply. I have inspected your title, the average response time from your DailyAPI Usage Details Report seems to be normal. The response time for /cloudscript/executefunction is a bit high, that depends on the complexity of your CloudScript functions. Since we notice the API runtime is normal in PlayFab backend, the long response time may also be caused by the local ISP, you may need to use edge service to help you reduce the response time if it is necessary. Please refer to this thread: https://community.playfab.com/questions/23052/china-latency-issue.html

In general, for the games that the timing matters, it is better to run PlayFab API in the background instead of waiting for the callback during the game. You may call the APIs at the beginning of the game, cache the data locally while sync data in the background with PlayFab, and then call the APIs to verify the uploaded data after the game ends.

10 |1200

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

Rick Chen avatar image
Rick Chen answered

What are the API calls you were making? Please note that the response time depends not only on the network but also on the request/response body of the API calls. If you were retrieve a large amount of data, it will be slow.

9 comments
10 |1200

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

omerkhalid avatar image omerkhalid commented ·

Authentication, add friend. Every call is taking this much time. My playstream scripts are also timing out because I can't even do basic operations within the 1 sec threshold

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ omerkhalid commented ·

Sorry for the late reply. To avoid this issue, you could look into way of executing the call that can be reliably retried (such as invoking it from a client cloud script call), as suggested in this thread: https://community.playfab.com/questions/37779/cloud-script-execution-time-limit-errors.html. Or you could use the Azure Function instead of the CloudScript, so that there will be no 1 second limit.

0 Likes 0 ·
omerkhalid avatar image omerkhalid Rick Chen ♦ commented ·

Hi Rick. This isn't just about retiring the call gracefully. A simple call exceeding a 1 sec mark is just too much and will create bad user experience. We are migrating from GS with a live game that has a 100k MAU. We cannot introduce this much lag especially in an already live game. This is going to be a major roadblock and would likely mean not transitioning to Playfab.

I am also executing these calls from south asia. Is it possible that the network has some sort of lag in this region?

0 Likes 0 ·
Show more comments
Greg Quinn avatar image Greg Quinn omerkhalid commented ·

Are your Playstream scripts using Azure Functions? If so you need to move your Azure Functions endpoint to US West as suggested in the docs to minimize latency.

0 Likes 0 ·
omerkhalid avatar image omerkhalid Greg Quinn commented ·

Thanks for the suggestion. Our function app is already in US West

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ commented ·

@omerkhalid May I have your Title ID? Cloud Script and Azure Function have 10 seconds limit for the execution time, unless it is a triggered or scheduled task. May I have some detailed callback results? Please remember to remove any private information.

0 Likes 0 ·
omerkhalid avatar image omerkhalid Seth Du ♦ commented ·

@SethDu I am right now only making login and add friend calls mostly from ClientApi

0 Likes 0 ·
omerkhalid avatar image omerkhalid Seth Du ♦ commented ·

The title id is 9F379

-1 Like -1 ·

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.