Mystery lag
#1

In my server there are occasionally wierd lags. Like when people drive around then some players teleport backwards and then thrusting forward in supernatural speed. The lag gets more intense as the player count grows. Wierd thing is... the smaller your playerid, the less lag you will encounter and produce. If you're bigger playerid, then you're lagging in other player vision awfully lot. Like players with 0-30 playerid's are pretty much okay. But over that most of the players start to lag... like in following video.

Preview about the lag 2:45-2:55 & around 3:28:
https://www.youtube.com/watch?v=NohcHbDnyLg

Resource usage (calculated by server monitoring):
RAM: ~60-150 MB
CPU (0 players): ~50 MHz
CPU (100 players): ~500 MHz

Server itself has 4GB RAM and CPU which has ~2450MHz (multicore).

Im using things like:
- mysql_static.so (R33/R34 if Im not mistaken...)
- streamer.so (newest release)
- sscanf.so
- Whirlpool.so
- crashdetect.so

- OPSP
- zcmd
- sscanf2
- cuffs
- getvehiclecolor
- gl_common
- gpcwv
- strlib
- alltextures
- zones
- Some YSI files also (but not many of them... only 2-3 of them... + sscanf)

Gamemode & Filterscripts are compiled and running on with newest GTA SA:MP server files.
Dynamic Objects in total ~14 000 (all of those objects are very specifically set to only specific Interior IDs where they are needed for use)

Does anyone know what might cause this kind of behaviour? Im really looking forward to fix that. Probably something in my script but I don't know what.
Also for extra information Im not using OnPlayerUpdate much to make stuff in that callback. I made my own player handling function which is called out once in a second where every player gets 'for cycled' and where all the logic towards player is done.
Reply
#2

How much packetloss is there on your server?
Reply
#3

Are there any new loops you have created that could be infinite and causing crashes? I'm inclined to believe if any it would be a player loop that's constantly running (higher player id = higher amount of times to loop) and therefore causing more lag with more players.
Reply
#4

To Antonio:
Packetloss is pretty much non existent. If you have solid and stable network connection then you're all fine. Even players with 0.0% packetloss are experienceing that lag hickups.

To Dokins:
Server does not crash. Server runs perfectly without crashes, havent encounter any crashes in a long time (more than a month or so - after when I fixed the source of crash). If there would be some infinite loop then the CPU would go 100% usage, but my CPU don't go higher than ~8% (which is ~400MHz - Player count atm is around ~60 max) under the current circumstances.

My gamemode's "core" function which handles player's data is working like this... When server starts then 1 function will be started via timer. This function will be called again when it stops and again... and again until the end of times.
In that function there is "for" loop, which cycles through all players who are in game (that means it doesnt go all the way up to MAX_PLAYERS aka 500, it only does logic for players who are online at the current point. In that function everything related to player is handled:
- How to manage food decreasing
- Custom HUD labels (speed, food, location, phone coverage)
- Weapon, Health, Armour, vehicle engine and so on Anticheats
- If player in vehicle then adding distance to vehicle odometer, also fuel decresion and so on
Aka pretty much most of the logic what happens all the time.

About how saving is handled in my gamemode... Things arent saved after some specific period. Saving is only done when something changes - like player gives something to other player (for example: money, weapons, other items, etc). Only things which change all the time constanly are put to save on specific period (for example vehicle odometer when driving - saved only if player exits vehicle / there might be few miles losses in time to time, but it's not so important data anyway, atleast not for my gamemode).
MySQL querys per minute for ~55 players is around ~410 (that includes all: select, insert, update, delete querys), so mysql querys arent also an issue. There also isnt any big tables or complex SQL querys which would make things on hold, also Im using threaded version of it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)