How to reduce strain on the server

I have been steadily adding features to my server as a result when more people join it starts to get pretty laggy, I’m not talking cpu lag or latency lag, but server lag, as in, props and doors being jittery, players as well, etc.

It used to be that with 32 players it was fine, but then it started to get pretty bad so I’ve capped the server at 28 slots and that did it, but now even with 28 it’s starting to get kinda laggy again.

I’m wondering, are there things I should be on the lookout for? I’ve been using a few nwint’s that I set pretty often, could this be the cause?

It would be hard to list all the things that cause substantial amounts of lag compared to other functions.

This may help : https://www.facepunch.com/showthread.php?t=1258511

Isn’t jitteryness cpu lag?

lua_run PrintTable(hook:GetTable())

Do that and give us the list.

hook.GetTable() *

And use what I linked you to dump the server side hooks, as it will us how long each hooked function took to run last time.

The colon in hook:GetTable() works as well, or is that just bad practice?

Bad practice

The colon inserts whatever you use it on as the first arguement. hook:GetTable() is the same as hook.GetTable(hook)

Thanks for your replies. Unfortunately DBug doesn’t seem to be working on the server. It works in singleplayer, but the server gives me an unknown command error when I try to do anything with it.

I also tried lua_run_cl (because just lua_run didn’t do anything) PrintTable(hook:GetTable()) and it gave me a bunch of hooks yes, but not their execution time or anything of the sort that I could make use of.

Edit: nvm it works now, alright gonna see how that looks…

Restart your server, check the addons in the right place, check it’s all in good condition ( not corrupted, no files missing, etc ). I’ve tested DBug on a SRCDS server and on the client and it works in both places.

Set your tick rate to 33?

Yeah sorry it’s working now.

Alright, so far it looks like the PlayX Range detection is just taking up a huge chunk on its own. 55%. Even more than the dbug profiler itself.

As for client, hudpaint takes 100% but that’s because there’s nothing else there.

Do sv_dbug_dump /log and sv_dbug_dump /log /time then copy both files from garrysmod/data/sv_dbug/ and post them here.

[editline]1st May 2013[/editline]

Oh and try to do this whilst your experiencing lag. Or turn on the auto-dump and set the time threshold appropriately.

Edit to your edit: That’ll have to wait then, nobody’s on the server that early in the morning.

DBug is currently incompatible with ULib, I’m quite busy at the moment so I won’t have time to fix it soon.

If you could do the same as I told you a post ago but without ULib present, DBug will catch the hooks; which it needs to do.

in darkrp/gamemode/server/main.lua

remove

[lua]timer.Create(“FlammableProps”, 0.1, 0, FlammablePropThink)[/lua]

This allows props to spread fire but it is horribly optimized and uses a lot of cpu.

Oh god .1 second delay

Does 10 findbyclass every .1 seconds. Maps with lots of entities (Like most darkrp maps which can contain over 500 entities which causes this to do 5000 entity type comparisons every .1 sec) will have pretty heavy cpu usage.

Alright I removed that bit but it seemed to be lagging still, especially with around 28 players or more.

Would making the tickrate 33 instead of 66 be a good way to help fixing this?

http://forum.facepunch.com/showthread.php?t=1267679&p=40502146&viewfull=1#post40502146