We have a game which we have been developing and can't seem to get the user count to get much above 2000 ccu using an unlimited license. Our servers are barely being taxed (~3% CPU and ~200MB memory at peak) so it doesn't appear to be a hardware issue. I'm curious if anyone has any recommendations to increase concurrent users. One particular issue I'm uncertain of is whether it makes sense to be creating a new taskScheduler for each game room or have a master taskScheduler at the zone level that attempts to update each of the (potentially thousands) of rooms.
Below is a breakdown of roughly how our game works.
Our game is broken into two separate components, a lobby server and game server(s).
The lobby server is a single room that's only job is to match users. As each user enters the lobby they are added to a thread safe list. A taskScheduler is set to run once a second and match up users with valid opponents. If a match is made then both clients are given the IP address of a game server and a unique room name. They then disconnect from the lobby server and connect to the game server. If no match is made they remain in the lobby until someone arrives that they can play against.
The game server has a zone level extension that handles the arrival of new users by adding them to a thread safe list and running a task periodically which creates new rooms for each pair of players that have arrived. The users are then moved into their rooms and the game begins.
Each game room holds two players and awaits actions from the players. These actions are stored in a pair of lists. A taskScheduler is set to run every 3 seconds and compare the first action of each users list sending the outcome to each player. This process continues until the game concludes and the players are disconnected.
While I know that without the exact code and circumstances a definitive answer on how to achieve a large number of users will not be possible, but any suggestions would be appreciated.
Thanks,
Dan
CCU Limit
Re: CCU Limit
Your server setup is interesting. Does your Lobby Server communicates internally with the Game Server or it is just functioning as a Load Balancer? My game's functionality is similar to what you have, only I don't have a Lobby Server. But I am using TaskSchedulers per room to process the actions of each user connected to it. And my TaskScheduler's interval is not periodic, it just re-spawn a new thread on the fly after completing the previous one. So far, it is working the way I want it. Though I haven't experienced touching the 2000 CCU ceiling yet as my game is on a private WAN.
"Dream it, I'll code it..."
Lead Developer
Optimal Solution Pte. Ltd.
Lead Developer
Optimal Solution Pte. Ltd.
Re: CCU Limit
I think I have already replied to your request via email (to you or a colleague of yours)
As regards the scalability issue I will repeat what I wrote in an email that had the same exact question:
If the CPU is not maxed out and you're not able to scale past 2K users chances are you are having some scalability issues with your extensions.
Typically it has to do with the configuration of the server thread pools, especially if your application involves frequent interactions with a database or other "slow" services.
I would recommend to read this, for starters, and experiment a little bit with the Extension-threads setting.
http://docs2x.smartfoxserver.com/Advanc ... extensions
Creating the scheduler for each Room defeats the purpose of the scheduler itself which is using fewer threads to handle many timed events. The good way to use it is keep it in a centralized place (e.g. the Zone, or a Singleton) and then size the thread pool in accord to the workload.One particular issue I'm uncertain of is whether it makes sense to be creating a new taskScheduler for each game room or have a master taskScheduler at the zone level that attempts to update each of the (potentially thousands) of rooms.
As regards the scalability issue I will repeat what I wrote in an email that had the same exact question:
If the CPU is not maxed out and you're not able to scale past 2K users chances are you are having some scalability issues with your extensions.
Typically it has to do with the configuration of the server thread pools, especially if your application involves frequent interactions with a database or other "slow" services.
I would recommend to read this, for starters, and experiment a little bit with the Extension-threads setting.
http://docs2x.smartfoxserver.com/Advanc ... extensions
Re: CCU Limit
Thanks for the input Lapo!
I had a feeling that a large number of TaskSchedulers seemed like a bad idea. I've modified it to run with a single scheduler and so far so good.
I believe one of our major bottle necks was in running all of our tests from a single network.
We've still got a few hangups to work out but I'll wait to post those in their own thread once we have a better handle on exactly what's causing the issue.
Dan
I had a feeling that a large number of TaskSchedulers seemed like a bad idea. I've modified it to run with a single scheduler and so far so good.
I believe one of our major bottle necks was in running all of our tests from a single network.
We've still got a few hangups to work out but I'll wait to post those in their own thread once we have a better handle on exactly what's causing the issue.
Dan