-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run on a single port using Netty #109
Conversation
…o reuse buffers but can't get it working yet
Use a shared threadpool of fixed 10 threads for request listening, handling, and outgoing messages. Also stop diverting GameDataEvents to the separate server dispatcher.
From some tests I ran, the current version is actually faster than the version we have at HEAD (0.11.2) even on single core machines, which was what I was struggling with before. The solution was to use a shared threadpool of a fixed 10 threads for listening to requests on a permanent coroutine, sending outgoing messages in a queue in a permanent coroutine, and handling requests. I also updated the KailleraUser.addEvent to be There is no doubt more tuning that can be done to increase efficiency. Some things I would like to try:
KNOWN ISSUE: If you ping the server and then try to join the server it will not let you in for some reason. Just joining the server directly works fine. |
…all data to come in. Also fixes an NPE.
Also get rid of custom Result class.
I got a trial of Intellij IDEA UE and tried out the profiler. Here is an overview of what I've learned about our code at HEAD from a 15 minute test with 1 player in game, all running on my desktop. MemoryTotal usage: 103 MB This is roughly divided equally into thirds between handling user requests, periodically reporting to master lists, and some kind of ktor business logic running behind the scenes supporting the master list requests. That leaves us with 38 MB from our core logic that we're concerned with in this PR. #CPU Total usage: 1.909s |
At commit ee8c340, a 15 minute test with 1 player in game, all running on my desktop. MemoryTotal usage: 230.54 MB Our main logic falls into about 130 MB (3.4 times as much as HEAD) Notes:
CPU
Total usage: 3.372s |
This looks pretty bad for integrating with ktor and/or coroutines... Some compromises we can take:
|
After removing coroutines and using Netty and native java for making HTTP requests, MemoryTotal usage: 74.67 MB, with our core logic fitting into 35 MB. CPUTotal usage: 2.5s It's possible this isn't consistently reproducible, is platform-dependent, scales differently with number of users or length of test. But I think it's clear this has the most promise, and I haven't done any threadpool tuning yet. |
Ideas for improving from here:
|
After some extended testing this latest version performs better than ESF, ESF 0.11.2, and ESX. I will do some additional cleanup on this PR, merge, it and use #114 to track pre-launch QA tasks. |
No description provided.