Performance / Scalability F.A.Q.
Revision 1.3, last update: February 2009
This is a collection of frequently asked question regarding performance and scalability of the server.
How many concurrent clients can SmartFoxServer handle?
This is a very difficult question to answer. There are many factors that will affect the final result; the most important are:
1. The hardware and operating system
2. What the multiplayer application does
3. The complexity of the server side extension (your custom server logic)We'll briefly examine these 3 aspects:
1 -> Hardware and OS
SmartFoxServer scales very well on multi-core / multi-cpu machines.
If you plan to build a high traffic (10-20k+ concurrent players) multiplayer application/game we would recommend to buy a dedicated server machine with a recent dual-quad processor (i.e. 2 dual core Xeon(s)) and at least 1 Gb of RAM.
Under all our tests we have found Linux to be the best performing and most stable operating system, especially under heavy loads.You can check detailed performance number in this white paper.
2 -> What your multiplayer application does
There's a huge difference between a chat application or simple turn-based game and an advanced real-time game with complex server side logic. While the former consumes very little server resources the latter can add significant load on the server process. Also the amount of data being transferred by the server has in important impact on the overall performance.3 -> The complexity of your server side extension
SmartFoxServer offers a powerful framework for developing multiplayer games, just like PHP or JSP do for dynamic web pages.
Because of this it's pretty difficult to predict how an application will behave without knowing the datails of the server side part.
Complex simulations and calculations on the server side can overload the server process.
We strongly recommend to profile your application in the early development stages, to avoid performance problems when going live.Just to give you an idea, a dedicated dual-cpu server (2.5ghz or higher) with 1Gb of RAM, will probably be able to handle between 10k and 20k concurrent users chatting and playing turn based games.
Moreover, there are optimization tips that you should use in order to squeeze the best performance out of your hardware setup and SmartFoxServer:
- Use the latest Java Runtime 6, as it offers improved performance.
- Fine tune your JVM and adjust its memory settings if necessary.
- Prefer a single Zone Level extension instead of multiple Room Level extensions.
- Java extensions perform better than those written in Actionscript and Python. If you really want the ultimate performance, write your extension in Java
- If you prefer scripting languages you can still enhance the performance by just writing the critical part of your code in Java and integrate them with your scripts.
- Prefer the JSON and/or String protocol as they consume less resources and bandwidth
- Reduce the access to external databases to the minimum. Continuous calls to external DBs can slow down the extension response.
- Make proper use of JVM threads. The server can be easily configured to use more or less threads in each server stage to exploit multi-core CPUs and process more data in parallel. For more informations threads and their configuration you can consult this detailed article.
We expect hundreds of thousands or millions of concurrent clients. Will SmartFoxServer handle such traffic?
We are often asked how the server will behave under almost unreal loads.
It would be really great if a web-based multiplayer game could reach those level of popularity, however it is very important to make realistic estimates.
As of today (February 2009) even the most trafficked gaming portals very rarely peak at 20 thousand simultaneous players. Very large web-based MMO communities claim to have millions of active users but those numbers refers to the registered members returning to the website withing a certian period of time. The amount of users all connected at once (concurrent users) rarely tops 100K even for the most popular games and virtual worlds out there.To give you an idea Second Life reached 75K+ simultaneous at peak times during 2008 with an average of 55K users between 2007 and 2008 (all the details here) Another very popular MMORPG, Eve Online, has recently broken a new user record at around 45K concurrent players.
In our load tests we have been able to run 20K concurrent clients on a single server instance running on a dual Xeon machine without any stability problems and consuming less than 25% of the CPU resources. We were expecting to saturate all the server resources and instead we realized that we could have reached 60K+ simultaneous users, if only we had enough test machines to create such a huge load (all the details here).
Our website has millions of registered users, how will the server scale?
Again, it's important not to confuse your website statistics with the number of real concurrent users
at any one time. They are very different numbers.
A very rough calculations of possible concurrent users would be: website_unique_visits_per_day / 100 (or 200)
So if you approximately receive 1.000.000 visits a day you could probably have a peak traffic of 5000 to 10.000 concurrent players.
Is it possible to split the load on multiple server instances?
Yes it is. If you plan to publish a very high traffic application we would recommend to split your "virtual world" into different regions or zones, and use multiple servers in parallel to avoid a single point of failure.
The world could be divided into various regions (Europe, America, Canada....) and Zones, each one handled by a different server instance. Also you could share the world data in a central (and why not, clustered) database server.The load balancing can be delegated to the users themselves, who can choose the region and the zone based on how busy they are.
Alternatively, this can be done in a transparent way for the client, by automatically choosing the less loaded zone inside the current region.
Is SmartFoxServer cluster-able?
Yes, we offer different options for running your applications on multiple servers:
- You can run multiple server instances in parallel by splitting your virtual world into regions and have each of them handled by one or more machines. With this technique you can create large MMOs and gaming systems at a fraction of the cost of a "traditional" clustered system.
The only drawback is that each server runs isolated from the others so if you need to share data across multiple instances you will have to use a central database which could become a bottleneck.
- You can integrate Terracotta with you server side extensions to create a highly available and scalable service with no single-point-of-failure. In May 2008 we officially released an in-depth white-paper that illustrates how to create a SmartFoxServer cluster for large MMOs and on-line game systems.
Terracotta is currently the leading technology for clustering the Java Virtual Machine, it operates behind the scenes at byte-code level, providing unprecedented scalability and fail-over resilience.
From an economic standpoint the integration of Terracotta with SmartFoxServer makes it possible to create large distributed gaming systems at a fraction of the cost of traditional solutions (based on caches and expensive databases).