• 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!

Linux VPS CPU usage, help.

DukeeH

Active Member
Joined
Dec 6, 2010
Messages
550
Solutions
3
Reaction score
39
Hello, id like some help, i've got a VPS about 2 months ago, made some changes on the server and it got to 130 players online really fast, but i'm having problems with some ppl complaining of lag, and when i when to check the usages (top command on ssh) it showed me this:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2537 root 20 0 1269m 1.1g 8180 S 84.9 28.9 57:09.88 theforgottenserver
(84% cpu usage, it goes from 80% to 96%, even 98 or 99 sometimes)

Specs:
1 vCPU 2.4Ghz+ 4 GB DDR3 1600Mhz 20 GB SSD

Cpu info: (cat /proc/cpuinfo)
root@servername:~# /proc/cpuinfo
-bash: /proc/cpuinfo: Permission denied
root@servername:~# /proc/cpuinfo
-bash: /proc/cpuinfo: Permission denied
root@servername:~# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel Xeon E312xx (Sandy Bridge)
stepping : 1
microcode : 0x1
cpu MHz : 2394.470
cache size : 4096 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc up rep_good nopl pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt vnmi ept fsgsbase smep erms
bogomips : 4788.94
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:

It's not that much (130 players) plus the map is small, but the only thing i have is attackspeed (about 150~ ms) and talking teleports (2s), is it right or there's some bug on source/scripts?

up.

up.

up.
 
Last edited by a moderator:
I would reccomend you deactivate the talking teleports and check cpu usage, if not, there may be a bug in scripts, try disabling npcs and check. If not, disable customised scripts. If then the issue continues it may be distro issue.
It would be a good idea to tell us the distro you're using.
 
Will try to disable talking tps, it's a bit hard because the server is on. But sometimes the cpu usage goes more than 100%.
Still need help.
 
Hello, id like some help, i've got a VPS about 2 months ago, made some changes on the server and it got to 130 players online really fast, but i'm having problems with some ppl complaining of lag, and when i when to check the usages (top command on ssh) it showed me this:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2537 root 20 0 1269m 1.1g 8180 S 84.9 28.9 57:09.88 theforgottenserver
(84% cpu usage, it goes from 80% to 96%, even 98 or 99 sometimes)

Specs:
1 vCPU 2.4Ghz+ 4 GB DDR3 1600Mhz 20 GB SSD

Cpu info: (cat /proc/cpuinfo)
root@servername:~# /proc/cpuinfo
-bash: /proc/cpuinfo: Permission denied
root@servername:~# /proc/cpuinfo
-bash: /proc/cpuinfo: Permission denied
root@servername:~# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 42
model name : Intel Xeon E312xx (Sandy Bridge)
stepping : 1
microcode : 0x1
cpu MHz : 2394.470
cache size : 4096 KB
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc up rep_good nopl pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm xsaveopt vnmi ept fsgsbase smep erms
bogomips : 4788.94
clflush size : 64
cache_alignment : 64
address sizes : 40 bits physical, 48 bits virtual
power management:

It's not that much (130 players) plus the map is small, but the only thing i have is attackspeed (about 150~ ms) and talking teleports (2s), is it right or there's some bug on source/scripts?

up.

up.

up.
try to rewrite some old scripts that are executed everytime
 
Check Console if there are any errors during lag time
try to rewrite some old scripts that are executed everytime
This, try everything and tell us if you solved it!
Checked both consoles (2 servers, different hosts) for a few minutes, the only errors I saw were this:
Code:
[Error - Action Interface]
data/actions/scripts/castlewar1.lua:onUse
Description:
(luaGetThingFromPosition) Tile not found

[Error - Action Interface]
data/actions/scripts/tools/rope.lua:onUse
Description:
(luaGetThingFromPosition) Tile not found
The first one was spammed.

Scripts:
lib/050-function.lua (function used on the action)
Code:
function expulsar(guild, fromx, tox, fromy, toy, z, outpos)
    for _x = fromx, tox do
        for _y = fromy, toy do
            local player = getThingFromPos({x = _x, y = _y, z = z, stackpos = 253}).uid
            if (isPlayer(player) == true) then
                if (getPlayerGuildId(player) ~= guild) then
                    doTeleportThing(player, outpos, false)
                end
            end
        end
    end
end
castlewar1.lua
Code:
-----------------------------------           
---------SCRIPT por PC98------------    NAO REMOVA OS CREDITOS     
-----------------------------------           


function onUse(cid, item, frompos, item2, topos)

------------------ Inicio das Config ------------

local castle_one_name = "Castle24h"                  -- Nome do castelo 1
local storages = {154154,54321,123123}               -- Storages ( se vc eh iniciante, deixe como está...)



-------PREMIOs  I N D I V I D U A L ---------

local premio_por_vezes = 0         -- Premio por vezes de conquista de castelo. (1) = Ativo  (0) = Desativa.
local premio_vezes = 0            -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
local premio = 5468                -- ID do Premio
local premio_cont = 0             -- Quantidade do Premio
local premio_reset = 1             -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM  (0) = NAO

-------FIM PREMIOs I N D I V I D U A L ---------




----------------- FIM DAS CONFIG -----------------

local sto_ativ = getGlobalStorageValue(storages[2])
position = getCreaturePosition(cid)


   if isPlayerGuild(cid) == TRUE then
      if sto_ativ == 1 or sto_ativ == -1 then

         guildname = getPlayerGuildName(cid)   
         guild = getPlayerGuildId(cid)             
         guild_sto = getGlobalStorageValue(storages[3])
        castleexit = {x = 160, y = 54, z = 7}
                
            if guild ~= guild_sto then           
               setPlayerStorageValue(cid,guild_sto,guild)                     
               if getPlayerStorageValue(cid,storages[1]) == -1 then
                  setPlayerStorageValue(cid,storages[1],0)
               end
              setGlobalStorageValue(321123, os.time()+(60*120))             
            
               setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
      
               doBroadcastMessage("O(a) "..getCreatureName(cid).." acabou de conquistar o castelo "..castle_one_name.." para a guild \""..guildname.."\".", 22)
              doSendMagicEffect(position, 39) 
            
              expulsar(guild, 42, 78, 1073, 1128, 7, castleexit)
              expulsar(guild, 62, 78, 1073, 1104, 6, castleexit)
              expulsar(guild, 58, 94, 1072, 1134, 8, castleexit)
                
                 if premio_por_vezes == 1 then
                    if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
                       if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
                          doBroadcastMessage("O "..getCreatureName(cid).." ganhou uma(o) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!", 21)
                          doPlayerAddItem(cid, premio,premio_cont)
                          doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
                        -----------------------------------------------  -- 
                            if premio_reset == 1 then                    --
                               setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                        -----------------------------------------------  --
                      
                       else
                       doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
                       addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                       end
                    end                                       
                 end             
            else
              doPlayerSendCancel(cid,"Este castelo ja foi conquistado pela sua guild!")
              doSendMagicEffect(position, 2)
            end
      else
      doPlayerSendCancel(cid,"O sistema está desativado")
      end     
   else
   doPlayerSendCancel(cid,"É nescessario ter guild para dominar o castelo!")
   doSendMagicEffect(position, 2)
   end
end


-------------------------  por pc98
function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end

rope.lua
Code:
local spotId = {384, 418, 8278, 8592}
local holeId = {
    294, 369, 370, 383, 392,
    408, 409, 427, 428, 430,
    462, 469, 470, 482, 484,
    485, 489, 924, 3135, 3136,
    7933, 7938, 8170, 8286, 8285,
    8284, 8281, 8280, 8279, 8277,
    8276, 8323, 8380, 8567, 8585,
    8596, 8595, 8249, 8250, 8251,
    8252, 8253, 8254, 8255, 8256,
    8972, 9606, 9625
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(toPosition.x == CONTAINER_POSITION) then
        doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        return true
    end

    local itemGround = getThingFromPos(toPosition)
    if(isInArray(spotId, itemGround.itemid)) then
        doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
    elseif(isInArray(holeId, itemEx.itemid)) then
        local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
        if(hole.itemid > 0) then
            doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
        else
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
        end
    else
        return false
    end

    return true
end

More info: (SCREENSHOT top command + online players) (First server goes up to 94% with this amount online)
rqiCi1i.jpg
I really should try disabling some globalevents to see if it will work. Will try to do it today, it's a bit hard with server online.
 
Back
Top