Jump to content

Server optimising


dewu

Recommended Posts

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 ..

Link to comment
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) 
  

Link to comment

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)

Link to comment

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...