question

raystorm avatar image
raystorm asked

Need clarification for pricing Meter Writes of Profile & Inventory

so from my understanding is that write is all counted separately.

so for example if i added or modify 10 keys in the player data in a single API call, it will count as 10 writes right?

so here are a few examples i need clarifications.

1. if i grant 100 items to a player in a single call, would this count as 100 write?

2. if i grant 100 items & added a custom data for each of them using "Grant Items To Users", would it count as 200 writes? (since it is writing 100 items and writing 100 keys of custom data).

3. for stackable items, if i grant 100 items & it stacked into 1, it's still 100 writes?

4. I'm guessing it is the same for currency, everytime i add the currency it will count as 1 write?

it would be a lot of help if these were clarified so I can optimize how i do the writes in these scenarios

Thank you.

pricing
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

·
Citrus Yan avatar image
Citrus Yan answered
    • so for example if i added or modify 10 keys in the player data in a single API call, it will count as 10 writes right?

    To be more accurate, each 1KB increases the Profile Write meter by 1 and each key value pair write is an minimum of 1 KB, therefore, if each key size is under 1kB, then yes, it would be counted as 10 writes. For more details, please see this section:

      https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/consumption-best-practices#data-and-statistics

      • if i grant 100 items to a player in a single call, would this count as 100 write?

      Inventory is also considered as Profile (of the player), so yes, it would counted as 100 writes.

      • if i grant 100 items & added a custom data for each of them using "Grant Items To Users", would it count as 200 writes? (since it is writing 100 items and writing 100 keys of custom data).

      Yes, that’s correct.

        • for stackable items, if i grant 100 items & it stacked into 1, it's still 100 writes?

        “When updating a stack, it's a good idea to call Player Item Management - Modify Item Uses to check whether you can just change the count of the stack, rather than adding N instances of the item which must each be processed for addition to the stack, then cleaned up.”

        https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/consumption-best-practices#inventory

          • I'm guessing it is the same for currency, everytime i add the currency it will count as 1 write?

          Currency is also a part of the Inventory, so yes, it will count as 1 write.

          Please also check out the doc on PlayFab Consumption: Best Practices that helps your optimize meter usages based on your specific title’s pattern. In your case, especially the following sections:

          Profile

          Inventory

          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.

          brendan avatar image brendan commented ·

          Quick follow-up: While changing the Count of an item is a much simpler way of add large numbers of a stackable item, a single Grant... will only count one write for the addition of a stackable item, regardless of the number added.

          1 Like 1 ·
          raystorm avatar image raystorm brendan commented ·

          Thank you for replying, i can optimize my write usage with this info.

          anyway is there any way to tell how big the size of a KVP, i only know that each character in UTF-8 is 1-4 byte (which if i put standard english text it's 1 byte per character on notepad), so i'm assuming if i use standard ASCII it would be 1 byte per character in the Key & Value, or is there an overhead from how playfab store the KVP?

          or i can just trust the size result from copying the KVP to notepad?

          0 Likes 0 ·
          Citrus Yan avatar image Citrus Yan raystorm commented ·

          PlayFab uses UTF-8 encoding, each character in the range U+0000 through U+007F is counted as a octet (byte), in a sense you can think of size return from notepad as the rough size of the KVP, however, we recommend that you use code to tell the accurate size instead.

          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.