question

drew avatar image
drew asked

ExecuteInventoryOperations rate limiting for Server API calls via Azure Functions?

hi,

My understanding (from threads like this) is that there is no rate limiting to Server API calls when made in Azure Functions.

However, the top of ExecuteInventoryOperations says this

Execute a list of Inventory Operations. A maximum list of 10 operations can be performed by a single request. There is also a limit to 250 items that can be modified/added in a single request. For example, adding a bundle with 50 items counts as 50 items modified. All operations must be done within a single inventory collection. This API has a reduced RPS compared to an individual inventory operation with Player Entities limited to 15 requests in 90 seconds and Title Entities limited to 500 requests in 10 seconds.

This is even more baffling when your EconomyV2 page claims that this works for hundreds of millions of players. If the API fails when 50 players try to do something with their inventory at the same time, I can't imagine EconomyV2 supporting even 1000 players.

Would really appreciate clarity on this, as if 50/s rate limit is true for Server API calls on AF's, this completely makes EconomyV2 only usable for games we expect to stay small.

EDIT: I just tested this and found it failing trying to do 15 ops in a row, even hosted on Azure. My game is a card game where the player can buy 20 packs at once and open them all at once. This means this is impossible with EconomyV2. The documentation page for EconomyV2 is extremely misleading by saying it can handle hundreds of millions of players at scale. If this was more clear, I would have never adopted EconomyV2.

In-Game Economy
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.

Greg Quinn avatar image Greg Quinn commented ·

As someone who is evaluating EconomyV2 for my game this is a shocking revelation. Yet this response from Playfab on how to implement Lootboxes suggests ExecuteInventoryOperations as the solution! https://community.playfab.com/questions/65054/how-to-implement-lootboxes-in-economyv2.html

0 Likes 0 ·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

We've been working on improving the documentation around throttling. Let me know what you think about the latest iteration. Hopefully it's getting better, but all feedback is greatly appreciated.

https://learn.microsoft.com/en-us/gaming/playfab/features/economy-v2/limits

6735-image.png


image.png (157.4 KiB)
10 |1200

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

Xiao Zha avatar image
Xiao Zha answered

The statement in the thread you mentioned may not be clear enough, APIs called in the Azure function has rate limit.

The Inventory APIs are throttled at the target entity level by design. When it comes to millions of players, since the target entity (the million players) is different, the limit is calculated separately for each target player.

The rate limit to call ExecuteInventoryOperations for Player Entity is 15 requests in 90 seconds.

The rate limit to call ExecuteInventoryOperations for Title Entity is 50 rps (500 in 10 seconds). However, title entity doesn’t have inventory items, so title entity cannot be the entity to perform this API and the limit here is currently meaningless. We apologize for the confusion, and we are working on documenting the entity limit design correctly.

Does “trying to do 15 ops in a row” mean you call the ExecuteInventoryOperations API 15 times or perform 15 operations in a single request? If it’s the former, if each API call does not reach the 250 items limit, you may try adding cards into bundles, then grant bundles to player to reduce the API calls. If it’s the later, a single request can perform up to 10 operations, you may try merging operations or split operations into two API calls.

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

drew avatar image drew commented ·

Thanks, so that doc is wrong and there is no limit at title level for these requests? It still leaves me stuck on a very simple scenario. Player can buy a pack of 40 cards. Each pack has 5 cards. Let's say they get lucky and there's no duplicates so we have to grant them 200 unique items. How in the world would this scenario ever be possible with EconomyV2? Bundles can't help me because this is random items he is granted.

1 Like 1 ·
Xiao Zha avatar image Xiao Zha drew commented ·

As I mentioned above, the Inventory APIs are throttled at the target entity level by design. Target entity means the entity to perform the API on. So, it’s not “there is no limit at title level for these requests”, it’s the title entity doesn’t have inventory items, so title entity cannot be the target entity to perform the API and the title limits for Inventory APIs are currently meaningless.

In your extreme case, as a workaround, after you get the 200 unique cards, you could create bundles and add the 200 cards into bundles (each bundle can contain up to 50 items, here it would be 4 bundles), then grant the bundles to the player, then delete the bundles. It's a bit cumbersome to do but it will suit your needs. Please note that there is a delay of about 500ms after you create the bundle before you can successfully send the newly created bundles to the player. You can use the retry mechanism to avoid sending failures.

0 Likes 0 ·
drew avatar image drew Xiao Zha commented ·

Thanks for the reply. I guess I'm asking if there's a global limit to these inventory operations? What if 10,000 players open a loot box of 10 items at once. This won't hit the target entity limit of 15, but is there some global limit of making this API call?

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

6731-image.png

What about AddInventoryItems? It has a title limit of 100 rps (1000 in 10 seconds). AddInventoryItems is specific to a player, so if 100 players at the same time open 10 card packs surely the Title limit will be reached quite easily for this then?

These Title limits are confusing and essentially stop a game from scaling. How is anyone supposed to build/plan a game around title limits? I understand player limits, but Title limits are ridiculous.

0 Likes 0 ·
image.png (20.5 KiB)
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

We know there are scenarios where developers want to grant hundreds of items at once. This is not possible with the API limits currently, but it is something we're working hard to optimize and increase.

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

dylan-1 avatar image dylan-1 commented ·

What if it's a card game, and folks are are operating with large packs of cards? And those limitations per title -- how are AAA titles handling these limitations, advertised as "battle tested" by them (creating the assumption that there's no custom limitations for them)?

EDIT: "it can handle hundreds of millions of players at scale." -- Interesting, they do advertise this.

Stealing the joke from someone else for some comic relief to laugh instead of cry at such a situation: "PlayFab - supports 100 million players as long as they don't actually do anything".

1 Like 1 ·
Greg Quinn avatar image Greg Quinn commented ·

To clarify, there are no Title Limits on Inventory then? What about AddInventoryItems?

6742-image.png

0 Likes 0 ·
image.png (16.8 KiB)

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.