Closed miguilimzero closed 2 years ago
Hello. The server codebase comes closer and closer to DDNet. It will be fair to compare the CPU load with another DDNet (or DDNet-based) server with a comparable number of players.
I started the server, joined with two players, and played for a minute.
The most expansive operation is the map loading — decompression of the server map, copy-pasting of the layers, (insertion of new extra layers for the client,) then compression with SHA256 checksum.
We had some regressions which resulted in much higher CPU usage but it was fixed long ago. Now everything seems to work as expected.
Personally I decided to disable MySQL integration to reduce the server load (now it is disabled by default and probably even broken). I'll continue investigation but I don't see what we can do.
For example, if you'll see that there are spikes in the load during rounds — maybe related to specific features or entity — then there would be something to work on. Right now the only missing load-reduction feature is a cache for server info requests, but it noticeable only when the server is under info-requests attack.
Infclass-specific load, measured during a game round (so this excludes map-related operations):
CInfClassHuman::FindPortalPosition
random_float()
. The dots animation can be rewritten from random to predefined.If we'll optimize all of that top-load by a magnitude, then the total server CPU load will be cut by about 8%
Only CInfClassGameController::GetBlindCharactersMask()
and CInfClassGameController::HandleLastHookers()
is something new. All other loads exist since necropotame original work (and inherited in yavl fork, and then here).
Because it is a teeworlds mod and the old version does not have this problem, I believe that this should not be expected and it must be a bug.
7 Mods + Yavl Infclass:
7 Mods + This Infclass:
The load depends on the current players. Yavl server was running for 1 minute, this server was running for 12 minutes. How many players had the servers? Or are we talking about a load with 0 players? If it is a "bug", then maybe it is in some specific player class.
E.g. slug
class creates 10x more load than a hunter
, because the slug slime
is very expensive.
@Kaffeine All servers were with no players at the round 0 for all mods. DDNet have the same and in some cases less CPU usage then the other mods, about to 1% with no players.
This Infclass starts using 40% of CPU with no players since minute 0 of the process.
In that case it must be a bug. I had no idea you're about an empty server. I'll investigate.
I found the issue. ThreadPool (IIUC it is used e.g. for registration on masterserver) caused an extra load even when idling. I need a few days to verify that the fix does not break something else (ThreadPool is a very danger place and a smallest mistake might result in a crash).
I'll run this code for three days and If there 'll be no regressions/crashes then I'll release v1.4.1 with this and a few more (important) fixes on March 23.
The fix is pushed to staging
branch for now (commit bdd449a305aacb56e546b83b0a4bd8215f484150). Feel free to try it, I would say that 90% that there is no regressions and this code works better than the current production.
What a fast fix! Now its working flawless.
Released.
Current version of infclass consumes huge amount of cpu compared to other mods and compared to yavl infclass. Making it impossible to host the mode on 1 core and 512 mb ram cloud servers, lagging the entire servers and all other mods hosted on it.
Because it is a teeworlds mod and the old version does not have this problem, I believe that this should not be expected and it must be a bug.
7 Mods with no Infclass:
7 Mods + Yavl Infclass:
7 Mods + This Infclass: