Help on Server Lag and Scripts

In my experience, and Im obviously not nearly as advanced as you guys, but the more communication the server has to do with the database, the laggier it gets. That's why epoch/overpoch are laggy shit storms. Lots of saved vehicle inventory, stashes, tents, safes, lockboxes, vehicles, base building, traders, etc.
I see you're on vanilla so I don't know how much of that applies to you. If you're filling those boxes with a database query it might cause some lag.
Also lots of weaponholders like dead bodies will cause lag. My server is very PVP heavy so I run a custom cleanup script, and occasionally I will execute the server cleanup through InfiSTAR as well.
Here's my custom cleanup, not sure if it will help you in any way but you're welcome to it.
Code:
private ["_time"];

_time = 300; // How often to run the cleanup script, in seconds.
_playerTime = 600; // How long must corpses be decaying for before they are removed? In seconds.

if (isServer) then {
    [_time, _playerTime] spawn {
        waitUntil { ! isNil "sm_done" };

        private ["_previousCheck", "_corpses", "_time", "_playerTime"];

        _previousCheck = diag_tickTime;
        _corpses = [];
        _time = _this select 0;
        _playerTime = _this select 1;

        while {true} do {
            if ((diag_tickTime - _previousCheck) > _time) then {
                _previousCheck = diag_tickTime;

                {
                    private ["_expired", "_processed"];

                    _expired = true;

                    if (isPlayer _x) then {
                        _processed = _x getVariable ["processedDeath", 0];
                        _processed = if (_processed >= 0) then { _processed } else { 0 };
                        _expired = if ((_processed + _playerTime) <= diag_tickTime) then { true } else { false };
                    };
               
                    if (_expired) then {
                        _x removeAllMPEventHandlers "mpkilled";
                        _x removeAllMPEventHandlers "mphit";
                        _x removeAllMPEventHandlers "mprespawn";
                        _x removeAllEventHandlers "FiredNear";
                        _x removeAllEventHandlers "HandleDamage";
                        _x removeAllEventHandlers "Killed";
                        _x removeAllEventHandlers "Fired";
                        _x removeAllEventHandlers "GetOut";
                        _x removeAllEventHandlers "Local";

                        clearVehicleInit _x;
                        deleteVehicle _x;
                        deleteGroup (group _x);
                        _x = nil;
                    };
                } forEach _corpses;

                _corpses = [] + allDead;
            };

            uiSleep 1;
        };
    };
};
 
From what you are saying, it would only be when i'm reading/writing from database into/out of something

Not all the time. I'm rarely doing those big writes, so I would think the fps would stay high otherwise. Also, not sure how that writing/reading would be directly tie to population count.


Thanks for the clenaup, i'm going to look through it and give it a shot.
 
But what EXACTLY is your server FPS so we can get a value from a working, highly populated server of what works for you. A real world example at startup, an hour after, and before restart ... ?
There is a line in the Overwatch server monitor that outputs the FPS every 3 minutes to your log if you didnt remove it. So we can extrapolate a graph of the server FPS over time using your RPT log .. (just post it if you want, I am curious enough to go through it).
[]execVM "\z\addons\dayz_server\system\s_fps.sqf"; //server monitor FPS (writes each ~181s diag_fps+181s diag_fpsmin*)

It would also be nice if we had a player count to go with that but that would require editing the C:\armaserver\@DayzOverwatch_Server\Addons\dayz_server\system\s_fps.sqf


while {isServer} do {
while {isServer} do {
while {isServer} do {
diag_log ("DEBUG FPS : " + str(diag_fps) );
diag_log format["DEBUG PLAYERCOUNT : %1", count playableUnits];
sleep 181;
};
sleep 181;
};
sleep 181;
};
 
On a side note, posting this while in an airplane high in the sky.

You can find the file on this part of my google site. Haven't figured out how to direct link form google yet.

https://sites.google.com/site/clandoolittle/resources

Maybe this works as a link?

https://sites.google.com/site/clandoolittle/resources/arma2oaserver.RPT?attredirects=0&d=1

You will find the following every 60 seconds in the file (had this setup already) ;

" [CLANDOOLITTLE][SafetyCheck]: 14.8976 FPS / 9 Playable Units / 33 Groups / 57 All Units / 158 All Agents / 366 All Vehicles"
 
Spot anything of interest shooting?
;) I was rather pointing my RPT suggestion to @DangerRuss ... His server is active so it would be a ideal reference for acceptable FPS.

I searched for the highest player count in the log which was 15, and I noticed that the FPS does not steadily drop over time, it drops and then will increase again. The lowest FPS is 8 which is the moment of 15 players. I assume the "all agents" are zombies and the "all units" include AI. Overall as the number of players increase, so does the Groups, ALL units and All Agents. The FPS is complex and we dont know of those zombies how many are actively targeting players ... same with AI. But the take-away message here is that the FPS does not steadily degrade over time, its entirely dependent on players, ai, zombies and objects.
For instance: the server run that starts around line 170 (pastebin line #s, not log line #s) starts at FPS of 50 and drops to 20's with players. Then it ends the run back at nearly 50.

Now the questions is: What has the largest impact on the FPS and when is the server FPS low enough to affect ALL players?

I extracted only the FPS lines and marked the restarts so you can easily view the FPS over time
http://pastebin.com/1885fsYW
 
Last edited:
Thank You.

I had observed that from earlier, but you did it in much more detail. I would think that the the tie to players would mean that scripts were a part of this, but as mentioned before disabling all the script loops did zero to shift the fps.

I'll see if DangerRuss will share his log with me for comparison.
 
My server FPS hovers around the mid twenties but will from time to time drop to 10. People will occasionally be unable to join the server until I restart it.. I lovingly refer to this as battle royale mode. I credit this more towards incorrect basic.cfg or myini settings.
 
Any idea how much load is caused from empty groups? I would think none, but can't find much on it.
 
write a script that creates 100 groups and see what happens. I agree it should be zero since there is no logic running. But YOUR groups are AI and players. Those random AI created all around players .. more players = more AI groups. And each group of AI has some logic of who to follow, who they are attacking, pathfinding etc . The zombies dont have groups (I dont think) as they are Agents and the createagent doesnt take a group parameter. So they act individually in accordance with their FSM. What if you spawned them as a group though? Could you create a horde of zombies that follow their leader and have more zombies while using few resources since 20 zombies in a single group are all getting their pathfinding and orders from the leader rather than 20 individual zombies all running the FSM.
 
Back
Top