question

Dawid Burek avatar image
Dawid Burek asked

API request limit reached when getting games list

I am creating a word game with async online multiplayer. My current design is to use SharedGroupData for game data storage and User Data for SharedGroupData references (player data can store up to 100 active games in a form of SharedGroupData Ids).

The problem I have is with custom GetGamesList function I wrote. It takes IDs of active games list from User Data and calls GetSharedGroupData for each. This triggers "PlayFab API request aborted, because API call count limit exceeded" error. As I understand, free tier allows for up to 15 API calls in a single request. Higher tier probably would allow me to handle the planned limit of 100 games, but I have a distinct feeling my design is wrong.

Will it scale at all or should I go the Photon Turnbased route or maybe even use custom solution with some kind of DB connection for games list storage?

10 |1200

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

Seth Du avatar image
Seth Du answered

I am not sure which platform you are implementing the game, but in many SDK, PlayFab API is designed to be called asynchronously. If you are simply using a loop to iteratively call GetSharedGroupData or any other API, it is very easy to exceed the limit.

The suggestion is to create a “Page” feature on the display. After the list of Shared Group ID has been retrieved, you may divide them into several pages in the client. Then, each data refreshing is on the basis of each page. For example, 5 groups are refreshed at a 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.

Dawid Burek avatar image
Dawid Burek answered

I am using Unity3D SDK, but the issue itself is in one of my CloudScripts. It takes UserData and iterated on its contents, getting SharedGroupData. My concern here is that even if I had paging, each time player refreshes games list, for each game there would be GetSharedGroupData call, just to check if anything changed. For example if player has 30 pending games, there would be 1 request to GetPlayerData endpoint (resulting in string containing 30 SharedGroupData id's) and 30 requests to GetSharedGroupData endpoint. If I would split it then would it scale to thousands of players? I can imagine situation where hundreds of players query games list at the same time, where each has at least a few games pending, which would result in thousands of GetSharedGroupData calls in short time.

Maybe it would be a better idea to store games list references in special SharedGroupData for each player?

4 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.

Seth Du avatar image Seth Du ♦ commented ·

Please understand for client API calls, the limit is on the basis of single player, which means one player's limits won't affect other players'.

It also means when a player gets data via your method in the client and no error is prompted, in most of the cases, other players won't have errors.

1 Like 1 ·
subsoap avatar image subsoap commented ·

Use a paged system and then enforce a wait cooldown in game client for changing page tabs.

1 Like 1 ·
Seth Du avatar image Seth Du ♦ commented ·

More importantly, costs in PlayFab are specifically usage-based, and it is highly recommended optimizing the call rates to be as low as you can manage while implementing any features. Having a single “summary” file that contains references to the various "savegame" files might be a workaround.

1 Like 1 ·
Dawid Burek avatar image Dawid Burek Seth Du ♦ commented ·

That's exactly what I was worried about. I guess I will have to implement both paging and data update timestamp in player profile, so that I don't have to get all SharedGroupData that did not change since last query.

Thanks both for your valuable input!

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.