question

Matt avatar image
Matt asked

MultiplayerServerTooManyRequests - NoHostsAvailableInRegion

Hi folks,

I'm getting this error despite a server instance running in that region. I've looked at other posts on the forum, and I've seen mention of not correctly shutting down the server. The problem is that I wasn't using the server in such a temporary fashion.

My game has a multiplayer mode in which 2 players will be paired up to compete against each other, the game lasts a few minutes, and they disconnect and move on (or rematch).

I've built my server to handle a large number of players that would come and go during the lifetime of the server. So I was expecting to have 1 instance of my server handling hundreds of players coming and going and it'd run 24/7.

Right now I'm calling PlayFabMultiplayerAPI.RequestMultiplayerServer, and I pass in (via titleData) the buildId, sessionId, and regions. It appeared to work once, and since then I'm getting the "MultiplayerServerTooManyRequests - NoHostsAvailableInRegion".

How can I continue to get players to connect to the server, get matched (I handle that within the server) and play correctly?

Thanks for the help! -Matt

multiplayer
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Neils Shi avatar image
Neils Shi answered

Please note that PlayFab Multiplayer Server is designed for session-based game and is not for long time running. For more info, please refer to Lifecycle of a multiplayer server - PlayFab | Microsoft Learn. Each time you call RequestMultiplayerServer API, it always transitions the server from StandingBy to Active. If you don’t have available StandingBy server, you will receive the error message “NoHostsAvailableInRegion”. In your scenario, you only want one server instance to handle hundreds of players, so, you only need to call this API once. After getting the server information like IP Address or Ports, you can share this information with other players then they can connect to the server.

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.

Matt avatar image Matt commented ·

Ah ok, so I could just save the IP and port in my titleData and let players use that for connection. Right now I store the buildId, region, etc, but IP and port would be much easier.

Looking at the lifecycle, after 10 days, the server would be shut down. But a new one would spin up after, right? I've implemented AI battles in case a match cannot be found for whatever reason, so it's fine if there's sporadic downtime.

I may have not come across a good description, but this is all still very confusing. An infograph showing the relationship between host, vm, and server instance would be amazing.

For instance, if the servers are to be session based, why is the cap only 10? My guess is that that particular cap is not server instances but server machines? I don't know, it's very confusing. In the case of my game, what would be the expected usage of the servers? And more importantly, which is more cost-efficient, because that is my biggest concern.

I don't want to abuse the system, but if I should be creating an instance for every 2 players matched, that means I also need the matchmaking (which isn't available in Unity on mobile).

0 Likes 0 ·
Matt avatar image Matt Matt commented ·

One more question...

After the 10 days, and the VM is shut down...if another one is started automatically, will it have the same address and port?

If not, how can I get that information quickly enough so I can relay it to my users so they can start connecting again to battle other players?

Would it better to run a 24/7 server as a process or a container? Assuming I can send the address and port to my TitleData on the Start of the server in either case.

0 Likes 0 ·
Neils Shi avatar image
Neils Shi answered

Looking at the lifecycle, after 10 days, the server would be shut down. But a new one would spin up after, right? if another one is started automatically, will it have the same address and port?

If a server is still running on the VM when the VM reaches its maximum lifetime of 10 days, the server will be forcibly terminated. MPS will create a new container/process in its place to replace the one that was terminatedand. But it is in standby state, you need to activate it. if there is only one server instance in a VM, then the address and port won’t change.

For instance, if the servers are to be session based, why is the cap only 10? My guess is that that particular cap is not server instances but server machines? I don't know, it's very confusing.

Multiplayer Servers includes a free and limited capacity of simultaneous cores to evaluate the building of multiplayer server games, and game developers enrolled in paid pricing plans can request additional server cores for their game title(s).

In the case of my game, what would be the expected usage of the servers? And more importantly, which is more cost-efficient, because that is my biggest concern.

Since your game is also session based, we recommend that you also use MPS in session-based mode. As for cost-efficient, you may do some tests to see which mode is better for you. For cost-efficient, you can also refer to Dynamic Standby - PlayFab | Microsoft Learn.

Would it better to run a 24/7 server as a process or a container?

As mentioned earlier, PlayFab Multiplayer Server is designed for session-based game, it’s not recommended to keep the server running constantly. Regarding the advantages and disadvantages of processes and container, you can refer to this thread : Server Build: Process vs Container - Playfab Community.

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.

Matt avatar image Matt commented ·

But it is in standby state, you need to activate it.

Is there a way for me to automate activating the server and, subsequently, setting its address and port from within the server's startup itself? After 10 days I don't want it to sit there waiting for me to manually do something.

I could definitely use a genuine, honest answer when it comes to pricing. I'm completely independent and can't afford substantial monthly bills. I saw the example bill break down and it was over $1,000. If I had 1 server running, 24/7, with those free 375 (I can only choose a 2-core system so the 750 free hours are split down to 375), my bill seemed like it'd be less than $100.

I've got my entire game done, substantial amount of code and content. It used to operate using the Legacy multiplayer servers. I can't run it at my home for obvious reasons, can I achieve this level of automation via PlayFab?

I need legacy-style functionality. I can't imagine that's not possible anymore, right?

By the way, thank you for the help, it's much appreciated. I'm close to being completely done with this game and eager to publish!

0 Likes 0 ·
Matt avatar image Matt Matt commented ·

If I have my server hosted by another service, is there anything I need to do to be able to make some TitleData, UserData, and CloudScript calls?

0 Likes 0 ·
Neils Shi avatar image Neils Shi Matt commented ·

We suggest that you may create a Scheduled Task and run Azure Function to control the server state. By this, the server can be activated after the restart, and you can control the restart time (restart when the number of players is the least), the players can also be notified of the maintenance time in advance.

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.