Predicting the global budget for MessagingService

The MessagingService, as of today, does not present a way to fetch the current budget available within’ a game like the DataStoreService does. (DataStoreService:GetRequestBudgetForRequestType)

The lack of a way to access the budgets greatly affected my plans of making a game heavily inspired by this post, which was the basis for most information that I could find.

I’ve spent weeks making, changing and validating formulas over and over again, but I am unable to reach a formula that correctly yields the time all servers would need to simultaneously wait to avoid hitting a limit that I can sadly only guess.

In these weeks, I found a lot of formulas and details that I believe would be key for this post, so here they are:

  • Limitation formulas
  • Most formulas provided in the documentation are written in Messages/min.
    Formula: (Base + Increment * Players|Servers) Msg/min
  • Dividing by 60 provides the rate in Messages/s.
    Formula: (Base + Increment * Players|Servers)/60 Msg/s
  • Dividing by Players|Servers yields the rate of a singular Player|Server.
    Formula: (Base + Increment * Players|Servers)/(Players|Servers) Msg/min
  • Replacing Players|Servers with 1 gives you the base rate of a formula.
    Formula: (Base + Increment * 1) Msg/min
  • Eliminating the Base value of a formula gives you its final rate.
    Formula: (Increment * Players|Servers)/(Players|Servers) or (Increment) Msg/min
  • Elevating by -1 returns you the interval between requests in Min/msg. (Best used in Sec/msg)
    Formula: (Base + Increment * Players|Servers)^-1 Min/msg or 1/(Base + Increment * Players|Servers) Min/msg.
    Note: To convert from Min/msg to Sec/msg you need to multiply by 60.
  • Server Limitation
  • 150 + 60 * Players, with a base rate of 210 Msg/min | 3.5 Msg/s.
  • Its final rate is 60 Msg/min | 1 Msg/s.
  • Global Limitation
  • 100 + 50 * Servers, with a base rate of 150 Msg/min | 2.5 Msg/s.
  • Its final rate is 50 Msg/min | 0.8333 Msg/s.
  • Topic Limitation
  • Note: This limitation is NOT shared across topics, each topic has its own limits.
  • 10 + 20 * Servers, with a base rate of 30 Msg/min | 0.5 Msg/s.
  • Its final rate is 20 Msg/min | 0.333 Msg/s.
  • The rates can be multiplied by the number of topics that has the same response.
    Formula: (10 + 20 * Servers) * Topics
  • Subscription Limitation
  • Note: This limitation is NOT in Msg/min, instead yielding the number of subscriptions a server can make.
  • 5 + 2 * Players, with a base of 7 Subscriptions.
  • Its final subscription amount (200 Players) is 405 Subscriptions.

With all of this information gathered, it would make sense I would’ve figured out something already, but my main problem is (I can only assume) the Global Limitation.

No matter how hard I try, if I follow the conventional formula given for it, get its singular rate, and convert it to Sec/msg, it always hits the budget after a while if more than a single player is present.

I’ve done the same procedurements with the remainder of formulas, and they all yield a perfect timing window between sending and receiving messages.

I wanted to know if its possible to, somehow, predict the available budget for the global limitation so I could keep a consistent rate of messages between servers.

Note: There is a good chance that the documentation for the global limitation is incorrect, especially since dividing the rate by Servers^2 and then converting it to Sec/msg has been giving me a consistent interval of time that doesn’t hit the budget at all, implying that the global limitation budget is subtracted by the amount of servers online everytime a message is published.