question

amazdeh avatar image
amazdeh asked

Batch Read/Writes of user data and failures

When we read/write multiple keys on playfab, either on user data or internal data, is it possible that some reads/writes fail and some succeed or it will be all or none?

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

·
brendan avatar image
brendan answered

Since each key is distinct, writing to all of them is not a single atomic operation. So technically, it's possible for one to be updated and not another from a single call. In practice, that would be exceedingly rare (and would result in an error response, allowing you to know to check the data or re-submit it). The much more common issue would be a call to set data which has an error (missing or invalid parameters, exceeding limits, etc.), in which case none of the data would be updated, as the call would be rejected.

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.

webmaster avatar image webmaster commented ·

Brandon -

Good to see you at the GDC. At the GDC, one of the Playfab developers recommended that we use this API to read all of the player data all at once:

https://api.playfab.com/Documentation/Server/method/GetPlayerCombinedInfo

The question is, if we use this API, is it possible that we can get a partial data back? (eg. we get back the playerData, but not the inventory or currency data?)

Also, based on your feedback above, we are now thinking of moving all of our player internal data under a single key. Would that be something you think is a good idea?

Thanks,

Andrew

0 Likes 0 ·
brendan avatar image brendan webmaster commented ·

Indeed, it was great to get to see everyone there!

For the first question, no, if you query for both user data and inventory/currency, you'll get both back.

For the second - whether it would be best to use a single key - the answer is "it depends". Basically, data Values of less than 1,000 bytes are still being treated as 1,000 bytes by DynamoDB. That's why small data values aren't efficient. However, if your aggregated Value would wind up being gigantic (100KB, for example), the time it takes the client to receive the data might impact the gameplay experience. So, if we're talking about collapsing a number of Values that are under 1,000 bytes into something like a 20KB JSON, then sure - that would definitely be a good idea. Otherwise, it might be best to talk about the specifics of your scenario.

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.