question

Denzie Gray avatar image
Denzie Gray asked

UserData Limits

@Brendan

Using this for reference, which includes an answer from you:

https://community.playfab.com/questions/515/207129407-Persistent-turn-based-games-.html?childToView=44937#comment-44937

In the thread you mention the key size for SharedGroup as 100.

When I look in the Limit section of the Dashboard I only see a limit of 300,000 bytes.

Can I get a breakdown of what I can expect to be able to store on the PlayFab server in terms of size and quantity?

I have a chess game variant and I would like to store replays and incomplete games for async/persistent play.

What API should I use to achieve this?

How many unique Keys can I populate per user or group?

Title DataShared Group Data
10 |1200

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

brendan avatar image
brendan answered

The legacy data elements are Key/Value pairs. The max Key size is 100. The max Value size is 300,000. When you write to the data, your JSON will always be like so:

{ "Key": "Value" } where Value is the data you want to store, and the Key is the lookup.

My recommendation would be to use the newer data systems - Entity Files, specifically, to store your replay data. I would also recommend not using Shared Group Data for anything other than for sharing data between a very small number of players, and only in cases where only one player at a time might be updating it. SGD is really just the old player data type, with no "owning" player, so it's very limited in use. The Entity data systems are far more robust.

That said, it would be best to get a clear picture of your design goals, in order to advise you on the best approach. How do you intend to share this data between players? How many games are you considering storing per player? You'll want to bear in mind the costs associated with reads, writes, and storage of the data - I'd recommend starting with the docs on our meter system (https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/pricing-overview) and the best practices guide (https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/consumption-best-practices).

10 |1200

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

Denzie Gray avatar image
Denzie Gray answered

@Brendan

Ah so by max key size of 100 you were simply talking about the size of the key not the amount of keys. Or am I mistaken? If the limit of unique keys is 100, where can I increase it, because I only see an option to increase the file size.

I took a look at the pricing and saw some data sizes are 'weighted'. Does that mean the cap is not hard but that we will pay when going over the limits described?

How large can I make the object size from 300,000?

As for a design goal, I will need:

1. A place to store all games a player has completed. We would use this to allow users to search up games from other players for replay purposes.

2. A place to store data related to an ongoing match.

- I was thinking of a group data that has the games latest state and the ids of the 2 players.
- The users would contain a list of gameids for games they are players in.

3. We planned on having spectators and that would require requests from other players for state.

- Does playfab have an effective way for a lot of people to make requests? (lets say alot is a few hundred).

Would Entity Files let me do some of these?

And is Title Data and etc a good place to store some of this global state?

I was using this as a frame of ref:
https://github.com/JohnTube/MemoryDemoCloudScript/blob/master/MemoryDemo.js

Assuming I wanted to save a globally access-able game, what would be a good substitute for the Update method on line 39?

EDIT:

I also saw this:

https://docs.microsoft.com/en-us/rest/api/playfab/admin/player-data-management/updateuserinternaldata?view=playfab-rest

Would this be a useful way to store gamelists (and maybe replays) for a user?

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.

brendan avatar image brendan commented ·

Yes, 100 is the size limit of the Key, not the Value or the total number of Keys. The total number of Keys isn't strictly limited, but should be kept reasonably small, since a) only 10 can be written at a time, and b) each contributes to your meter usage every time it is written or read.

For the meter usage, "capping" usage would be disastrous for titles, as it would mean the game would arbitrarily stop working, as far as users are concerned. All usage above the included meter amounts is charged at the rates shown in the pricing page (http://playfab.com/pricing). And yes, the meters spin based on the total KB read/written, for profile and configuration read/writes. The best practices guide I linked above goes into a lot of detail on that.

I'm not clear on what you're asking about "object size". The 300,000 byte limit is specific to the legacy data model.

For your design: If you want to have many players be able to request the data, SGD will not work. You must use Entity Objects or Files (or an external data system). Title Data cannot be used to store data players update. How are you planning on enabling search for gameplay data?

0 Likes 0 ·
Denzie Gray avatar image
Denzie Gray answered

@Brendan

By object size I mean this:

"Shared group data value size

Size of a shared group data value, measured in UTF-8 encoded bytes."

I was asking for the size limit but it seems Entity files would be best

What I gather is that should I go over any of the limits described I will simply be charged rather than have the game come to a halt. Correct? If so, then I won't question the current limits atm.

I also have some server-side data for the client that I don't want them to access.

Should I use Entity or the InternalUserData?

https://docs.microsoft.com/en-us/rest/api/playfab/admin/player-data-management/updateuserinternaldata?view=playfab-rest

In this case, I would only update 2 keys/values infrequently using InternalUserData for a player.

For gameplay data I plan to have ongoing games viewable in Photon so we don't have to worry to much about that.

But I would like:

1. Storage for all completed games.(global)

2. A list for all incomplete games.(this could be merged into item 3)

3. And each user would have a list of incomplete game ids to resume,

4. and a smaller, list of ids of games for replays(also per user)

For items 2-4, I could use the Entity files?

I guess would need to lock out the Entity API from the client as I will update them on the server.

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.

brendan avatar image brendan commented ·

Yes, the legacy data systems aren't designed for what you have in mind - you'll want to use Entity Objects and Files. In terms of limits, attempts to exceed limits do result in error messages, and the data in those cases isn't updated, so it is important to make sure you're not running into that.

It's possible to block client devices from accessing Entity Objects/Files, but if you have a mix of both data you want the client to access and data you don't, it would be simplest to separate those by having the no-access data in user internal data. If you want to entirely update the data from servers, you can indeed block the client from that, though.

In terms of your goals, I'm still concerned that we're not on the same page for definition. "All completed games" is a very open-ended statement, implying that you might want to save an unlimited amount of data per player. I really can't recommend that, as the costs for that would be extreme. But yes, for saving game data, you could use Entity Objects or Files, depending on how large the save data is.

0 Likes 0 ·
Denzie Gray avatar image Denzie Gray brendan commented ·
@Brendan

Sorry, let me try again.

A master collection or table that stores all ongoing games.

A master collection or table that stores all completed games.

The 2 collections are not per player.

Each player would have a list of ids that correspond to the
replays or incomplete games they have yet to finish. I would then use the ids to access the games from the previously mentioned tables as keys.

Only one person would be able to edit/update a game at a time.

0 Likes 0 ·
brendan avatar image brendan Denzie Gray commented ·

Conceptually, what you want is to have a "space" where you save each player's ongoing and completed games. That would be done using the method I described, in Entity Objects or Files (depending on the size). There doesn't appear to be anything in what you described that would make that nor work for you - players would still manage a list of IDs for ongoing and completed games that they access, it's just that what they're accessing is specifically an Entity Object or File associated with their Title Entity, or with a Group Title Entity created for tracking of that specific game (likely the latter, based on what you're describing). Can you clarify why you believe this won't work in your design?

There is no data system that supports exactly what you described in PlayFab - we do not provide open query tables (specifically because that's the most common point of failure in online titles when they grow to scale), and neither User/Shared Group Data nor Entity Objects/Files can support (potentially) millions of players trying to access the same resources.

0 Likes 0 ·
Show more comments
Denzie Gray avatar image
Denzie Gray answered
@Brendan

"question is on downloading files to a server"

I was talking about using the API on cloudscript to open an EntityFile on the server. Is this possible in cloudscript?

Ex:

var file = server.OpenEntityFile(args)

/// use file data?

Also, I saw this:

https://community.playfab.com/questions/30710/entities-entity-groups-and-using-them-as-persisten.html

I have a few questions about EntityGroups.

Is the limit of Files the number of groups you are apart of or the number of groups you created/own?

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.

brendan avatar image brendan commented ·

Reading (and writing) an Entity File would be possible from a queued Azure Functions Cloud Script. That would allow you to exceed the normal time limit on the call, so that you have plenty of time to read the file and then re-write it, as needed.

The limit referenced in the other thread is the number of Entity Files a Group can have. A Group can have up to 1,000 Members.

0 Likes 0 ·
Denzie Gray avatar image Denzie Gray brendan commented ·

@Brendan

By limit in this case, I was referring to the Limit of files in the limits section. It currently says 5. I wanted to know if that is per user ownership or simply being apart of a group?

0 Likes 0 ·
brendan avatar image brendan Denzie Gray commented ·

That's per Entity. But the Entity in question should be the Group, so that shouldn't impact you.

0 Likes 0 ·
Show more comments
Denzie Gray avatar image
Denzie Gray answered
@Brendan

Ok so I can be apart of an infinite number of groups?

I can also have as many groups for a game as I want? Is there a limit here or it's just limited by the 50,000 GB of title entity file size?

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

brendan avatar image brendan commented ·

Nothing can technically be "infinite", since all resources are finite in some way. We do not strictly limit the number of Groups you create, but please bear in mind that all Groups contribute to the Profile meters (ex: creation of a group hits the Profile Write meter - https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/meters/profile-writes).

1 Like 1 ·
Denzie Gray avatar image Denzie Gray brendan commented ·

@Brendan

Thank you for the answer.

I notice that the examples for EntityKey/Groups are in C#.

Are there any CloudScript Examples in a git somewhere?
I know I can't access the EntityFiles on the server but I would Like to manipulate other things in the Group for persistence on the cloud.

0 Likes 0 ·
brendan avatar image brendan Denzie Gray commented ·

Here's a simple example: https://community.playfab.com/questions/35025/how-do-i-read-entity-title-data-objects-from-my-ba.html. A running Cloud Script can call the Entity API methods in the context of the Title Entity.

0 Likes 0 ·
Show more comments
Denzie Gray avatar image
Denzie Gray answered

@Brendan

Ok, I have more questions.

What if I never delete my shared group data?

Is there a cost to that? Will they be cleaned up eventually?

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

Denzie Gray avatar image Denzie Gray commented ·

@Brendan

What I am asking is:
If I never delete a group is there any cost to that? Or am I only paying for read-write?

0 Likes 0 ·
brendan avatar image brendan Denzie Gray commented ·

Yes, that would be metered as Profile Storage (Pricing Meters - PlayFab | Microsoft Docs). Storage is fairly inexpensive, but it could conceivably add up, if you're using it a lot and never removing it. Shared Group Data cannot be automatically cleaned up, as there's nothing to indicate to the service when the data is no longer needed.

0 Likes 0 ·
Denzie Gray avatar image Denzie Gray brendan commented ·

Is there an ETA on being able to have group deletion in batches? It seems like a waste of API calls to have to do a delete individually.

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.