OK guys (and mainly AM),
I think I have a great news for the improvement of Aseco performance (well, not exactly Aseco perfs but more Aseco impact on server performance).
This solution is still under tests but I wanted to share it with you since some server holders may encounter performance issues using aseco.
Being in Sharkteam with J-S, we encounter performance issues on our dedicated server since we started Nations Speed Addiction server, which gathers an average of 60 players 24/7 with 100 players peaks and is configured with Aseco 2.2.0c.
Indicators like "Load Average" or "Cpu usage" were concerning.
And after having taken a look at aseco code, I had an idea. I instrumented the main loop to profile the execution and I extracted quantities of data from it.
First thing learned from this :
- there are many times where the main loop doesn't do anything significant (typical time spent in a loop : couple of ms, mainly in Callbacks)
- The loop is executed at an average frequency of 140 Hz (depending on the configuration).
And I thought that there were no reason to waste cpu time looping so many times for a limited number of "useful" loops.
The other observation I made is that Aseco actions do not need a strict real-time execution.
So I decided to test this loop with an additional "sleep" part where Aseco script is basically not running. The tricky part was to find how much time the script should sleep on each loop to let cpu breathe on one side and execute the loop often enough to limit in-game latency effects.
So I made the loop sleep for 200 milliseconds at each loop. This largely lowers the "useless" loops and lets cpu do more interesting things (like running other server aseo scripts !)
Here is the effect on pictures, before the yellow limiter, standard Aseco 2.2.0c with a couple of plugins and on the right side, modified main loop . We do have other TM servers running on the same machine, but you can see that NSA impact is the main one !
So this screen shows number of players on NSA on last 7 days :
The correspond Load Average on last 7 days:
And finally the cpu charge :
The only one thing that changed is this line
at the end of the while(true) loop in Aseco::run() method.
I have figures too if someone is interested.
Note : I know that in the Aseco::executeCallbacks() method, the readCB() do use a timeout that makes the script sleep as long as no callback is received, but I think it won't be smart to increase this timeout because if you're not lucky (or if your server is crowded), you won't sleep so much in each loop ...
And again, Aseco do not need realtime response to these callbacks ...
For those who are still reading, what do you think about this ?
I have to say, this very little improvement will change our lives (maybe we'll be able to raise NSA players limitation) and