The application is no longer in active public development, all futher work moved to private, this repository turned into read-only mode for historical reference. It was a great experiment, thanks to all supporters and contributors.
BenchmarkNet is a console application for testing the reliable UDP networking solutions.
Supported networking libraries:
You can find the latest benchmark results on the wiki page.
Each simulated client is one asynchronous task for establishing a connection with the server and processing network events. Each task has one subtask which also works asynchronously to send network messages at a specified interval (15 messages per second by default). So, 1000 simulated clients are 1000 tasks with 1000 subtasks which work independently of each other. This sounds scary, but CPU usage is <1% for tasks itself, and every operation is completely thread-safe. The clients send network messages to the server (500 reliable and 1000 unreliable by default). The server also sends messages to the clients in response (48 bytes per message by default). The application will monitor how the data is processed by the server and clients, and report their status in real-time.
TPL performs load-balancing of the coarse-grained tasks with an awareness of oversubscription for clients. A custom scheduler with per core worker thread has no effect in this application because of the semi-continuous execution of tasks with a fixed re-scheduling interval. The server process is running with higher priority to let the operating system make optimal decisions.
The application helps to determine many various problems:
Before launching the application set the desired parameters in the config file to override the default values. Run the application, select the networking library and set any number of simulated clients. Do not perform any actions while the benchmark is running and wait until the process is complete.
When you are going to perform a test with less than 256 simulated clients, it's highly recommended to switch GC mode from Server GC to Workstation GC. You can find more information in this article about how different GC modes are working.
You can use any packet sniffer to monitor how the data is transmitted, but it may affect the results.
You can find the discussion in the thread on Unity forums.
If you have any questions, contact me via email.
Any support is much appreciated.
These wonderful people make open-source better: