getApi().setUserVariables() is bringing down server at player count of 1000

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

shahidbits2012
Posts: 16
Joined: 09 Jun 2021, 07:23

getApi().setUserVariables() is bringing down server at player count of 1000

Postby shahidbits2012 » 13 Jul 2021, 05:57

Hi Team,

We are facing scaling issues with Smartfox. We are observing the CPU usage hits 100% with 1000 users in the room.
The clients are sending updates every 2 sec and this update is broadcasted to all the clients in the room via

[getApi().setUserVariables(user, variables)][/code]

Is this expected with such a number (like 1000).
If yes, what is the room's optimal user limit for such operation?
If no, can you please share how can we fix the issue (Threadpool config etc)?

User Var Update Broadcasting ON
Screen Shot 2021-07-13 at 3.30.51 AM.png
User Var Update Broadcasting ON
(251.62 KiB) Not downloaded yet


User Var Update Broadcasting OFF
Screen Shot 2021-07-13 at 4.40.46 AM.png
User Var Update Broadcasting OFF
(244.72 KiB) Not downloaded yet


CCU License=10,000
VM CPU=4 Cores
VM Memory=16GB

Thanks!
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: getApi().setUserVariables() is bringing down server at player count of 1000

Postby Lapo » 13 Jul 2021, 08:22

Hi,
yes a 1000 users in the same Room broadcasting large updates is indeed a problem, not just for the server but also for clients who will receive an insane amount of messages back (and will likely fail to keep up).

If every user sends a request that is broadcast back to everyone, with a 1000 users you have 1000 requests going to the server each generating 1000 responses, for a total of 1000*1000 = 1Million updates. :shock:

You can clearly see it in the screenshots you have sent, where you there are spikes up to 140MBytes of outgoing traffic which is over 1.1Gbit of outgoing network data.

Standard Rooms in SFS2X are meant for small groups of people, especially if you're using broadcast events. Also standard Rooms have to broadcast the user list to everyone and keep them updated about who's joining and who's leaving, which results in more broadcast events.
Typically you want to limit the number of players to 50 although you could probably get away with ~100 as well, if you limit the number of broadcast messages. 1000 users is way too much.

That's why MMORooms exist :) They are specifically designed to handle 1000s of users by limiting the broadcast message to an "Area Of Interest". You can read the details here:
http://docs2x.smartfoxserver.com/Advanc ... /mmo-rooms

Hope it helps
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 45 guests