question

bkiefer1992 avatar image
bkiefer1992 asked

GetLobby Throttled

Hey guys,

Using the Unity SDK, I'm calling GetLobby once at most every five seconds to poll and update my lobby UI. I've breakpointed the _MakeApiCall method inside the PlayFabHttp class of the PlayFab Unity SDK to confirm the frequency. After about a minute or so, an error is logged, "The client has exceeded the maximum API request rate and is being throttled".

Are there limits per-API? Is there a more strict limitation on this API to encourage developers to use the PlayFab Multiplayer SDK instead? I've looked into using the PlayFab Multiplayer SDK for Unity and I'd rather avoid it if possible.

Is there something I'm missing here, or am I unable to periodically call this API at this frequency?

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

·
Rick Chen avatar image
Rick Chen answered

This API rate limit is designed to help protect the performance of the service for all titles and prevent malicious people from spamming the API calls. As you may see in the [Game Manager]->[your title]->[Title Settings]->[Limit], there is a limit called LobbyGetsPerTitle. If we don’t limit the API rate, this limit can be exceeded rapidly. I would suggest you reducing the API calling frequency and caching the results.

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.

bkiefer1992 avatar image bkiefer1992 commented ·

Thanks for your reply Rick,

I see the LobbyGetsPerTitle in my title settings in the Limits section. The current limit shows a value of 48,000. It seems like this might be a global limit for all players over a longer period. Is that the case?

I was more referring to a single users usage over a short period of time. I've heard there's a burst limit of 100 API calls per two-minutes (which may be outdated). My case of an update call every five seconds is well and truly under that (120 seconds / a call every 5 seconds = 24 calls in 2 minutes).

I also understand there are some analytics API calls going on (/Event/WriteEvents). In the worst case scenario that all API calls are collectively limited to 200 calls / 2 minutes, I still don't think it'd go over.

I'm unable to cache results, as you've suggested, because I'm periodically polling the lobby API to find any new users and state changes.

Would you be able to please tell me how many API calls a single user can make over a short period of time? Also, any further suggestions that may help would be greatly appreciated.

Thanks again Rick!

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

In this case, the clients can subscribe to the lobby resources to receive real-time notification from the lobby, and you don’t need to poll the GetLobby API. Please refer to this document for more detail: Real-time notifications for Lobby and Matchmaking APIs - PlayFab | Microsoft Learn.

-3 Likes -3 ·
bkiefer1992 avatar image bkiefer1992 Rick Chen ♦ commented ·

This looks like exactly what I need!

I'm using WebGL so WebSockets will be fine. First pass I'll use the GetLobby/UpdateLobby APIs to get things rolling, after which I'll switch over to using real-time notifications.

Thanks very much.

0 Likes 0 ·
Show more comments

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.