• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

CPU HIGH + STATS LOGS

rubraon

New Member
Joined
Aug 29, 2016
Messages
16
Reaction score
1

What happened?​

I'm experiencing high CPU usage, causing server lag. 190 players on average
DEDICADET:
12 RAM
CPU(s): 4
Model name: Intel(R) Xeon(R) E-2286G CPU @ 4.00GHz
CPU MHz: 4008.000

How to Reproduce?​

Just leave 190 Players online or more.

Relevant log output​

Lua:
[08/10/2021 10:33:08]
Thread: 1 Cpu usage: 87.9966% Idle: 11.9939% Other: 0.00951842% Players online: 0
 Time (ms)     Calls     Rel usage %    Real usage % Description
    193882      2940       73.44309%       64.62740% std::bind(&Game::checkCreatures, this, (index + 1) % EVENT_CREATURECOUNT)
     15537      1971        5.88570%        5.17922% std::bind(&Game::executeDeath, &g_game, getID())
     13137    482199        4.97641%        4.37907% std::bind(&Game::checkCreatureWalk, &g_game, getID())
     10705      5418        4.05517%        3.56841% std::bind(&LuaEnvironment::executeTimerEvent, &g_luaEnvironment, lastTimerEventId)
      6467      1023        2.44980%        2.15574% std::bind(&Game::checkDecay, this)
      4875      7959        1.84684%        1.62515% functor
      4125     46177        1.56265%        1.37508% &Game::playerSay
      3064     82369        1.16082%        1.02148% std::bind(&Game::updateCreatureWalk, &g_game, getID())
      3020    114524        1.14436%        1.00699% std::bind(&Game::checkCreatureAttack, &g_game, getID())
      2138      3539        0.80999%        0.71277% std::bind(&Game::playerUseWithCreature, this, playerId, fromPos, fromStackPos, creatureId, spriteId)
      2009     15701        0.76137%        0.66998% &Game::playerUseWithCreature
      1043       237        0.39509%        0.34767% std::bind(&GlobalEvents::think, this)
      1002     29616        0.37976%        0.33417% &Game::playerMove
       583    143084        0.22106%        0.19453% std::bind(&ProtocolGame::parsePacketFromDispatcher, getThis(), msg, recvbyte)
       403     13273        0.15301%        0.13464% &Game::playerSetAttackedCreature
       264      5474        0.10034%        0.08830% std::bind(&Spawn::scheduleSpawn, this, spawnId, sb, interval - NONBLOCKABLE_SPAWN_INTERVAL)
 
TFS version?
Default TFS monsters use low cpu and react very slow. If someone 'fixed' it for you (using THIS fix: Solved - Weird monster behaviour in TFS 1.1? (https://otland.net/threads/weird-monster-behaviour-in-tfs-1-1.228021/#post-2200365) ), monsters may use 10% of CPU with 1 player fighting vs 15 monsters. Your checkCreatureWalk walk executes very fast. Maybe someone moved walkpath calculation to checkCreatures.

Monster CPU usage is discussed here:

checkCreatures includes onThink Lua event. Check lua.log, lua_slow.log and lua_very_slow.log. Maybe there is a Lua script that lag your server. I worked once for server, where 'auto-eat' script used 99% CPU with 200 online.
 
Last edited:
TFS version?
Default TFS monsters use low cpu and react very slow. If someone 'fixed' it for you (using THIS fix: Solved - Weird monster behaviour in TFS 1.1? (https://otland.net/threads/weird-monster-behaviour-in-tfs-1-1.228021/#post-2200365) ), monsters may use 10% of CPU with 1 player fighting vs 15 monsters. Your checkCreatureWalk walk executes very fast. Maybe someone moved walkpath calculation to checkCreatures.

Monster CPU usage is discussed here:

checkCreatures includes onThink Lua event. Check lua.log, lua_slow.log and lua_very_slow.log. Maybe there is a Lua script that lag your server. I worked once for server, where 'auto-eat' script used 99% CPU with 200 online.
Im using

But a 10/12x version, I have some optimizations like multistacks, I also have some WPE protections in game.cpp...

In relation to what you gave me, I saw that it was changed, I'm going to revert it today on serversave. - I can't imagine any LUA that has a problem, there's nothing CUSTOM in the datapack.
 
I can't imagine any LUA that has a problem, there's nothing CUSTOM in the datapack.
It's otservbr. Everything there is bugged. Are there any reports in lua_slow.log or lua_very_slow.log?

There is added 'fast reaction' in otservbr:
but somehow it does not consume much CPU:
Code:
     3064     82369        1.16082%        1.02148% std::bind(&Game::updateCreatureWalk, &g_game, getID())
82369 calls took 3.064 miliseconds. On TFS these calls would take 0.3-0.6 ms per call, so it would be 25.000 - 50.0000 miliseconds. Maybe these calculations are somehow moved to checkCreatures.

Add me on Discord: Gesior.pl#3208 and send me other log files. Maybe I will find reason in them.
 
It's otservbr. Everything there is bugged. Are there any reports in lua_slow.log or lua_very_slow.log?

There is added 'fast reaction' in otservbr:
but somehow it does not consume much CPU:
Code:
     3064     82369        1.16082%        1.02148% std::bind(&Game::updateCreatureWalk, &g_game, getID())
82369 calls took 3.064 miliseconds. On TFS these calls would take 0.3-0.6 ms per call, so it would be 25.000 - 50.0000 miliseconds. Maybe these calculations are somehow moved to checkCreatures.

Add me on Discord: Gesior.pl#3208 and send me other log files. Maybe I will find reason in them.
Yes I have all the stats logs, I'll talk about DC. - Helena Rubra#0310
 
There is added 'fast reaction' in otservbr:
but somehow it does not consume much CPU:
Code:
     3064     82369        1.16082%        1.02148% std::bind(&Game::updateCreatureWalk, &g_game, getID())
82369 calls took 3.064 miliseconds. On TFS these calls would take 0.3-0.6 ms per call, so it would be 25.000 - 50.0000 miliseconds. Maybe these calculations are somehow moved to checkCreatures.
@Gesior.pl seems to be related to #44
 
Versão do TFS?
Monstros TFS padrão usam baixa CPU e reagem muito lentamente. Se alguém o 'consertou' para você (usando ESTA correção: Resolvido - Comportamento de monstro estranho no TFS 1.1? (Https://otland.net/threads/weird-monster-behaviour-in-tfs-1-1.228021/#post- 2200365) ), os monstros podem usar 10% da CPU com 1 jogador lutando contra 15 monstros. Sua caminhada checkCreatureWalk executa muito rápido. Talvez alguém tenha movido o cálculo da trilha para verificar as criaturas.

O uso da CPU Monster é discutido aqui:
[URL unfurl = "true"] monsters bug when running · Issue #1650 · otland/forgottenserver (https://github.com/otland/forgottenserver/issues/1650) [/ URL]

checkCreatures inclui o evento onThink Lua. Verifique lua.log, lua_slow.log e lua_very_slow.log. Talvez haja um script Lua que está atrasado em seu servidor. Trabalhei uma vez para o servidor, onde o script 'auto-comer' usava 99% da CPU com 200 online.
Há algum tópico ensinando como instalar esses logs? ("lua.log, lua_slow.log e lua_very_slow.log", etc). Poketibia 0.3.6. Ou pelo menos algum link que o tenha instalado para ser pego (se for possível instalar no 0.3.6)?
 

What happened?​

I'm experiencing high CPU usage, causing server lag. 190 players on average
DEDICADET:
12 RAM
CPU(s): 4
Model name: Intel(R) Xeon(R) E-2286G CPU @ 4.00GHz
CPU MHz: 4008.000

How to Reproduce?​

Just leave 190 Players online or more.

Relevant log output​

Lua:
[08/10/2021 10:33:08]
Thread: 1 Cpu usage: 87.9966% Idle: 11.9939% Other: 0.00951842% Players online: 0
 Time (ms)     Calls     Rel usage %    Real usage % Description
    193882      2940       73.44309%       64.62740% std::bind(&Game::checkCreatures, this, (index + 1) % EVENT_CREATURECOUNT)
     15537      1971        5.88570%        5.17922% std::bind(&Game::executeDeath, &g_game, getID())
     13137    482199        4.97641%        4.37907% std::bind(&Game::checkCreatureWalk, &g_game, getID())
     10705      5418        4.05517%        3.56841% std::bind(&LuaEnvironment::executeTimerEvent, &g_luaEnvironment, lastTimerEventId)
      6467      1023        2.44980%        2.15574% std::bind(&Game::checkDecay, this)
      4875      7959        1.84684%        1.62515% functor
      4125     46177        1.56265%        1.37508% &Game::playerSay
      3064     82369        1.16082%        1.02148% std::bind(&Game::updateCreatureWalk, &g_game, getID())
      3020    114524        1.14436%        1.00699% std::bind(&Game::checkCreatureAttack, &g_game, getID())
      2138      3539        0.80999%        0.71277% std::bind(&Game::playerUseWithCreature, this, playerId, fromPos, fromStackPos, creatureId, spriteId)
      2009     15701        0.76137%        0.66998% &Game::playerUseWithCreature
      1043       237        0.39509%        0.34767% std::bind(&GlobalEvents::think, this)
      1002     29616        0.37976%        0.33417% &Game::playerMove
       583    143084        0.22106%        0.19453% std::bind(&ProtocolGame::parsePacketFromDispatcher, getThis(), msg, recvbyte)
       403     13273        0.15301%        0.13464% &Game::playerSetAttackedCreature
       264      5474        0.10034%        0.08830% std::bind(&Spawn::scheduleSpawn, this, spawnId, sb, interval - NONBLOCKABLE_SPAWN_INTERVAL)

@Gesior.pl how can i get this kind of log? i tried perf and htop but it look different on my system :( i have same problem like you guys, 100people online = cpu burning even with 12cores,32gb ram,1gb/s of connection every maybe 20-30 second i have ping spike jumping from 50 to 250-300ping and after 2-3 second coming back to normal. help please its killing me i changed my dedicated server 5 times i was thinking its ddos i lost so much time and money i need medication because of this.​

 
Back
Top