• 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

joseotero

New Member
Joined
Aug 29, 2016
Messages
11
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)
 

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,368
Solutions
44
Reaction score
1,823
Location
Poland
GitHub
gesior
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:
OP
OP
J

joseotero

New Member
Joined
Aug 29, 2016
Messages
11
Reaction score
1
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.
 

Gesior.pl

Mega Noob&LOL 2012
Senator
Premium User
Joined
Sep 18, 2007
Messages
2,368
Solutions
44
Reaction score
1,823
Location
Poland
GitHub
gesior
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.
 
OP
OP
J

joseotero

New Member
Joined
Aug 29, 2016
Messages
11
Reaction score
1
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
 

Ramon Bernardo

Active Member
Joined
Oct 7, 2018
Messages
65
Solutions
2
Reaction score
40
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
 

linsoul

New Member
Joined
Jan 4, 2017
Messages
9
Reaction score
2
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)?
 

Similar threads

Top