question

Kim Strasser avatar image
Kim Strasser asked

How can I can calculate the costs of client API GetLeaderboard?

I don't know which value that I should use for MaxResultsCount. I'm afraid that the costs get too high if I use a high value for MaxResultsCount because a player can call API GetLeaderboard again after a certain amount of time in my game and I don't know what the costs are for each API call. In addition, I don't want to display large leaderboards in my game because no one cares if he/she is number 1950 or 2120 in a leaderboard, therefore I will only display the very best players. But I don't know what it costs if a player calls client API GetLeaderboard for example 20 times or more in one day.

How can I calculate the costs for client API GetLeaderboard?

I use this code in my game:

var result = await PlayFabClientAPI.GetLeaderboardAsync(new GetLeaderboardRequest()
{
    StatisticName = name,
    MaxResultsCount = 100,     
    ProfileConstraints = new PlayFab.ClientModels.PlayerProfileViewConstraints()
    {
        ShowStatistics = true,
        ShowDisplayName = true,
        ShowTags = true,
        ShowCreated = true,
        ShowLastLogin = true
    }
});
Leaderboards and Statistics
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

PlayFab's pricing is calculated from a set of consumption-based meters. GetLeaderboard API is in the scope of ProfileReads meters. For reads, 1 KB in the total data returned increases the meter count by 1. For example, if the GetLeaderboard API returns 50KB data, it will increase the Profile Reads meters by 50, calling 20 times is 50x20=1000 ticks in the meters. For more detail, please refer to this document: PlayFab Consumption Best Practices - PlayFab | Microsoft Learn. And you can check the price table in this document to calculate the total price in your account plan.

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

Kim Strasser avatar image Kim Strasser commented ·

There is no PlayStream event created for GetLeaderboard API in my title's account when a player calls client API GetLeaderboard. Is it not possible for me to find out the returned KB data of client API GetLeaderboard?

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Kim Strasser commented ·

You can try calling the API using Postman, on which the response size is shown. Or you can check your Daily API Usage Details report, which shows you the summary of your API usage stats.

0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Rick Chen ♦ commented ·

I get the following values in Postman for client API GetLeaderboard. Currently, there is only one player's score in this leaderboard and I use the following ProfileConstraints:

"ProfileConstraints":
                {
                    "ShowStatistics": true,
                    "ShowDisplayName": true,
                    "ShowTags": true,
                    "ShowCreated": true,
                    "ShowLastLogin": true
                }

In my example, would the costs be 1.25x20= 25 ticks? I have not yet tried what the response size will be if there would be much more players in the leaderboard.

0 Likes 0 ·
Show more comments
Rick Chen avatar image Rick Chen ♦ Kim Strasser commented ·

You can refer to this page Pricing (playfab.com) to calculate the price. For example, if you are on Pay-as-you-go Plan, the profile reads price will be $0.33 per million reads. Using your billing summary as example, which has 0.68K profile reads (680 reads), the cost of profile reads will be 680 x (1/1,000,000) x $0.33 = $0.0002244. Other costs can be calculated with this process.

0 Likes 0 ·
Kim Strasser avatar image Kim Strasser Rick Chen ♦ commented ·

I'm not sure if I have understand how to calculate the number of profile reads.

In my billing summary, I have 0.68K profile reads (680 reads) for October 2022.

But I don't know how much the profile reads in my billing summary will increase if I would just add the 1000 ticks in the meters from the previous example to my profile reads billing summary.

For reads, 1 KB in the total data returned increases the meter count by 1. For example, if the GetLeaderboard API returns 50KB data, it will increase the Profile Reads meters by 50, calling 20 times is 50x20=1000 ticks in the meters

Would my profile reads increase from 0.68K to 1.68K if I would add the 1000 ticks in the meters from the previous example to my billing summary?

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.