High CPU usage on dedicated
#1

Hi there! The following problem is :

My server has every day online atleast 200 players, but on 150 players CPu goes very high and server starts lagging.

I know that its problem due to gamemode, so any experienced member could assist me, about how could i reduce cpu usage, what uses too much resources and stuff?

Because i know a servers with 500 players online and their cpu usage is 30-40%~, altough i on 150 players has 60-70% ..

BTW edit: We use same dedicated, so its not problem to dedciated server.
Reply
#2

You should optimize your script, by creating a stock for certain common or general things which you use often.
Reply
#3

I've created stock for almost everything, i don't know if that could make some problem.

I'm more wondered about onplayerupdate, and timers could make problem?
Reply
#4

YES! Dont use OnPlayerUpdate at all. That's the reason for heavy lags. Trust me, i've experienced about OnPlayerUpdate. And try to have less timers, more timers = more lag. And try not to use stock for silly things.
Reply
#5

Buy a bigger CPU.
Reply
#6

If you're using plugins on the host like crashdetect or nativechecker don't. Erase them they use CPU.
Reply
#7

Could give the Performance profiler plugin a try. https://sampforum.blast.hk/showthread.php?tid=271129
That should show the most heavily used functions and callbacks and should show the issue.

Quote:
Originally Posted by Pravin
View Post
YES! Dont use OnPlayerUpdate at all. That's the reason for heavy lags. Trust me, i've experienced about OnPlayerUpdate. And try to have less timers, more timers = more lag. And try not to use stock for silly things.
I wouldn't say don't use OnPlayerUpdate but definitely watch what you do using it.

And as for more timers = more lag that personally is kinda silly. Same concept as OnPlayerUpdate, if you have crappy unoptimised code running under a timer it will obviously slow things down. From personal experience i can say spreading things out to multiple timers can lighten the load and help with sync if done right.
Reply
#8

Optimize your loops, they rape CPU more than any timer, also don't try making loop inside loop unless you REALLY must do it
Reply
#9

Limit your OnPlayerUpdate usage if you wish to use less CPU, https://sampforum.blast.hk/showthread.php?tid=220089

Go to the end of the first post and read "How To Use OPU In An AC"

Only if you think checking 30 times in second is a lot though, if you really need it, then don't limit it.
Reply
#10

Thank you so much, i will test this performance profiler, and i will check this "How to use OPU in an AC"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)