Jump to content

Server optimising


dewu

Recommended Posts

Posted

Hi guys.

I have a server with DayZ Mod and sometimes when items are respawning server is shutdown, because of high processor usage.

Is any way to optimise script with respawning function?

Posted
Hi guys.

I have a server with DayZ Mod and sometimes when items are respawning server is shutdown, because of high processor usage.

Is any way to optimise script with respawning function?

There are a lot of ways to optimize a script, for example you could load areas one by one, by that i mean lv is loaded at first, then ls and so on ..

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted
Your server won't shutdown just because it uses too much CPU, the only thing you may notice are lag, the real issue might be lack of RAM or a generally unstable hardware

MrBrutus, I used one of the best external Polish hostings.

When items are respawn CPU usage in web server monitor is like 170% ;o

manve1, Okay, but how I can do that in script?

I found this script there, it will works? How to implement it?

  
function infiniteLoopFunction() 
    local lastresume = getTickCount() 
    while true do 
        --do something 
  
        if getTickCount() > lastresume+200 then 
            coroutine.yield() 
            lastresume = getTickCount() 
        end 
    end 
end 
  
function resumeLoopThread() 
    coroutine.resume(loopThread) 
end 
  
loopThread = coroutine.create(infiniteLoopFunction) 
resumeLoopThread() 
setTimer(resumeLoopThread, 400, 0) 
  

Posted

That code is kind of useless, unless you use it for collecting data.

But what you would have to do is either re-script the spawning system and do few tables instead of one, then spawn each area every second or so. or you have to collect data on which pickup it is spawning then you would allow it to refresh the loot or not + store the areas that are not been refreshed (this is a lot more complicated but is more elegant and faster)

Looking for tutorials or information? check out: www.simpleask.co.uk

  • Moderators
Posted

Rewrite the code.... And reduce the ammount of database calls.

Or buy a better server which can handle terible laggy gamemodes as that.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...