We would like to know the maximum number of API requests PlayFab can handle for each pricing plan. (I am currently on the free plan)
Our game is designed to have 3000 users logged in at the same time upon release.
To verify that PlayFab can handle that load, we created a console application and ran the API. (Source code is attached below).
And when we created the 10th player, we got the following exception
ElapsedTime: 3464ms, custom Id: user_0
ElapsedTime: 3709ms, custom Id: user_1
ElapsedTime: 3965ms, custom Id: user_2
ElapsedTime: 4204ms, custom Id: user_3
ElapsedTime: 4441ms, custom Id: user_4
ElapsedTime: 4681ms, custom Id: user_5
ElapsedTime: 4873ms, custom Id: user_6
ElapsedTime: 5103ms, custom Id: user_7
ElapsedTime: 5363ms, custom Id: user_8
ElapsedTime: 5578ms, custom Id: user_9
!!!Exception!!! ElapsedTime: 5718ms , custom Id: user_10
ExceptionMessage: The client has exceeded the maximum API request rate and is being throttled
1-6493fffd-44a2a9445c0d8ea06295daad
using System.Diagnostics;
using Cysharp.Threading.Tasks;
using PlayFab;
using PlayFab.ClientModels;
namespace MyApp;
internal class Program
{
static async UniTask Main(string[] args)
{
await Login(3000);
}
private static readonly string titleId = "xxxxx";
public static async UniTask Login(int userNum)
{
var settings = new PlayFabApiSettings { TitleId = titleId };
var sw = new Stopwatch();
var customId = string.Empty;
try
{
sw.Start();
var instance = new PlayFabClientInstanceAPI(settings);
for (var i = 0; i < userNum; i++)
{
customId = $"user_{i}";
var result = await instance.LoginWithCustomIDAsync
(
new LoginWithCustomIDRequest
{
CreateAccount = true,
CustomId = customId
}
);
if (result.Error is not null)
{
throw new Exception(result.Error.GenerateErrorReport());
}
Console.WriteLine($"ElapsedTime: {sw.ElapsedMilliseconds}ms, custom Id: {customId}");
}
}
catch (Exception e)
{
Console.WriteLine($"!!!Exception!!! ElapsedTime: {sw.ElapsedMilliseconds}ms , custom Id: {customId}");
Console.WriteLine($"ExceptionMessage: {e.Message}, Stacktrace: {e.StackTrace}");
sw.Stop();
}
}
}