A server platform built specifically to support massively multiplayer online games, the SmartFoxServer(SFS) is preferred by game developers all around the world. The server application not only supports Flash-built games but supports Unity, Mono, .Net, Windows 8, HTML5, iOS, Windows Phone 8, Android, and Java SE/EE as well. However SFS is not the only big fish in the sea. There are several competitors in the market out of which Apache Mina server and Netty server applications are the closest competitors. And any ways when you are talking about the last man standing in a clash of the titans, we definitely need to analyse suspiciously, measure accurately and compare them justly.
In our previous post we introduced SmartFoxServer and all its awesomeness, in this post however we will look into how awesome SFS is when compared with other server applications.
SmartFoxServer Scalability and Performance:
Whenever the question of choosing the perfect server comes into concern, performance vs scalability is among the most discussed topics which really need clarity and a thoughtful resolution. There are a variety of requisites which need to be kept in mind while one evaluates a server product for the project.
While we dive further into the details, I first want to you to address few common questions which could help you comparing SmartFoxServer against others easily. With custom based tests you can easily evaluate and analyze the server in terms of performance, scalability and server side architecture. These common questions are:
- How many concurrent (which expresses the number of players simultaneously interacting with the server) clients SmartFoxServer can handle at one given time?
- What will be the recommended hardware configuration for my said project?
- Will my hardware configuration be able to handle (any number) of concurrent users?
- Will SmartFoxServer be able to perform and scale optimally if we reach to (a big number) of users?
Taking the topic of performance and scalability farther, let’s familiarize ourselves first with certain parameters and phrases which we shall be coming across in the tests discussed.
|CCU(Concurrent users)||Total number of users participating in the tests at a given time.|
|Message Size||Average size of the messages per second exchanged between client and server.|
|Message Rate||Amount of messages per second exchanged between a single client and the server.|
|CPU and Memory Configuration||Amount of CPU and memory utilized during a process.|
|Bandwidth Usage||Mass of data a server can handle.|
|Hardware Specifications||Description of server machine in terms of hosting which includes RAM, system architecture and CPU type.|
Comparison between SmartFoxServer, Apache Mina, and Netty
The key-performing core network engine of SmartFoxServer 2X, known as BitSwarm, provides various advantages over other competing game servers. It is specifically designed keeping in mind the massive multiplayer games and therefore works efficiently well over all-purpose socket libraries specifically Apache Mina 1.x.
By creating two alternative servers and plugging with the same protocol used by BitSwarm 3.x, along with Mina 1.1.7 and Netty 3.2.3, some benchmark tests were performed and result were compared in order to better understand the difference which exist between the three. The test is repeated three times with simultaneous increase in network pressure 16Mb/s, 128Mb/s and 512Mb/s.
For all tests our server machine have the same configuration
Intel Core2 Duo, 2.2Ghz
Linux Ubuntu 9.04
OpenJDK Server VM 1.6.0_0-b12
Test 1: The Discard Message test
The first test was to bombard the server machine with discard message. The main aim was to simulate the condition in which the client side sends a message which is obtained by server side, decoded, then the decoded object is ultimately discarded. In short we are testing the receiving and processing capabilities of server and since no message is sent back it leaves out the outgoing capabilities of server from test.
Msg Size: 1024 bytes | Rate: 1 msg/s | Clients: 2000 | Target traffic = 16Mbit/s
Msg Size: 8192 bytes | Rate: 1 msg/s | Clients: 2000 | Target traffic = 128Mbit/s
Msg Size: 16384 bytes | Rate: 1 msg/s | Clients: 4000 | Target traffic = 512Mbit/s
As you may see it takes a lot to crash SFS server.
Test 2: Echo Message Test
In this test the server machine is bombarded with client messages which the server is made to send back to the client. Kind of like echoing back the message. This not only tests the input capabilities but also the output capabilities of the server under pressure.
Msg Size: 1024 bytes | Rate: 1 msg/s | Clients: 2000 | Target traffic = 16Mbit/s
Msg Size: 2048 bytes | Rate: 1 msg/s | Clients: 3000 | Target traffic = 50Mbit/s
Now you may notice that the testers have taken message size at 2048 byte and then bombarding it by per second basis. In real life this is not possible. No single user can do that per second basis. However when we take into account 100 thousand users messaging simultaneously, our server will experience the similar pressure.
Msg Size: 2048 bytes | Rate: 1 msg/s | Clients: 6000 | Target traffic = 100Mbit/s
(*) Crashed at the end of test when all clients are disconnected at once
Test 3: Broadcast Echo Message Test
This is the most aggressive test. In this test the server is bombarded with messages and is made to reply back the same message to all the connected clients.
As you may see both Mina and Netty crashed with increasing pressure while SFS prevailed.
Along with the above tests, the Garbage Collection and processing capabilities of the three servers were also tested, result of which is shown in the below graphs. As you may see Netty still proved to be the most in-efficient of the three with SFS dominating over all others.
SmartFoxServer vs Others:
Comparing SmartFoxServer with other server architectures can be a daunting task as various solutions come with some or the other pros and cons. Many have taken a resort to use generic engines like Apache Mina which are not as finely tuned to multiplayer as compared to SmartFoxServer. There are a few prominent differences when these servers are compared on scalability and performance grounds. An extra lag of few milliseconds of more CPU usage can be negligible but when this reaches to tens or hundreds or thousands of connections this makes a considerable difference. SmartFoxServer delivers consistent performance at quite different levels of scales of traffic and usage.
Using low-latency optimizations, specific threading architecture and other amazing features allow server architecture to deliver best performance under all conditions. In a simple broadcast test where we generated 10,000 messages/sec over 1Gbit connection, both the servers Apache Mina engine and SmartFoxServer were able to sustain the same network throughput but the SFS took less than 10% of the CPU and therefore hit the garbage collector very lightly, whereas Apache Mina took more than 50% and therefore, caused frequent garbage collection. Conclusively, SmartFoxServer performance results are relatively more efficient under same conditions as compared with Apache Mina, with same throughput.
Comparison with Inferences:
People have been saying that SmartFoxServer has gained popularity and hence preferred for a multiplayer game. It has been targeted for the Flash platform but it has also provided highly specialized solutions and won the attention of large enterprises as well. These are various positives in this server are:
- Server is available as a free version which supports approx 20 concurrent users.
- API is well-designed, well structured.
- Easy understandability and implementation.
- Examples and codes are easily understandable.
- Lot of extensibility, functionality for managing permissions and users!
People have used this as a server solution for multiplayer games. They buy its license and set up their own server or use cloud option. The extensive features like ability to deliver real-time multiplayer, chat etc. makes it possible to save lot of man-hours. Also the action-script 3API have attracted many users to try it. Some positives are:
- The cloud service has a free plan
- Easy to set up a game and get connected.
Both solutions the SFS and the Photon Real-time seem good enough in their own ways and vary on actually different grounds. SmartFoxServer can be opted for flash multiplayer game development but opt it only if you have excellent server skills. Photon cloud services are initially simpler but later the APIs become complex and harder to work on. I believe SmartFoxServer initially requires a lot of your toil but at the same time it offers you wider chances in developing games faster and better.To know more about SmartFoxServer for Mobile Multiplayer Gaming App Development read my blog which discusses in detail about the Gaming Application Development.
References: Indiegamepod, Gamecraft Blog, SmartFoxServer, NetEase