Lag Problem
#1

Hey, i have lag problem in my server.
CPU Usage %2~5 and i got 1gb free ram still. Is it because of network connection?
btw i use ******' timers instead of settimer.
Reply
#2

Can we take a look at your OnPlayerUpdate callback?
Reply
#3

Sorry im mobile now

In PlayerUpdate

Calculating vehicle speed
Checking for teleport/airbr. hack
Calculating Fuel
Checking Weapon Hack
Total km counter etc.

Sometimes we play with 65 players nolag, sometimes we play with 2-5 players laggy
Reply
#4

May be it's a silent DDoS.

Try to buy a Gameserver host for your SA-MP server it's better then SA-MP on VPS.
Reply
#5

What is your network allowance/speed?

How is your MySQL connected?
Reply
#6

100mbit shared network, im using mysql at localhost, i store most data at arrays to avoid mysql traffic
Reply
#7

This can be caused by many different things, huge inefficient saving systems, too many timers, using OnPlayerUpdate or big/infinite loops.
Reply
#8

Quote:
Originally Posted by jawiie
Посмотреть сообщение
Sorry im mobile now

In PlayerUpdate

Calculating vehicle speed
Checking for teleport/airbr. hack
Calculating Fuel
Checking Weapon Hack
Total km counter etc.

Sometimes we play with 65 players nolag, sometimes we play with 2-5 players laggy
Well, it is advised to use the least number of code in OnPlayerUpdate to avoid any mess and/or lag spikes. Seemingly, you're using y_timers which would be very effective if you add the code that you have on OnPlayerUpdate to an existing timer you have created to a short-time-interval.

It might not be the main source of lag, but it could help to minimize it as possible. Also, are you sure you're not being DDoSed?

Are you using something like:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
for your loops? Try minimizing your loops as much as you can unless you're confident they don't hurt - try foreach.inc?
Reply
#9

Quote:
Originally Posted by Nixco
Посмотреть сообщение
Well, it is advised to use the least number of code in OnPlayerUpdate to avoid any mess and/or lag spikes. Seemingly, you're using y_timers which would be very effective if you add the code that you have on OnPlayerUpdate to an existing timer you have created to a short-time-interval.

It might not be the main source of lag, but it could help to minimize it as possible. Also, are you sure you're not being DDoSed?

Are you using something like:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
for your loops? Try minimizing your loops as much as you can unless you're confident they don't hurt - try foreach.inc?
to slow down the function calls in onplayerupdate i used counter that trigger functions every 5 callback is it bad? while while server lagging, remote desktop connection stucks? could it be ddos?
Reply
#10

Quote:
Originally Posted by LinuxViper
Посмотреть сообщение
May be it's a silent DDoS.

Try to buy a Gameserver host for your SA-MP server it's better then SA-MP on VPS.
That's unlikely.

If you'd like to provide evidence or reasoning for your second point, feel free. Other than the minimum amount of overhead on a proper, well configured hypervisor, you shouldn't have any issues running SA-MP on a virtual server. If you run it on a $3 server that is 'too good to be true' such as OVH's VPS offerings, expect issues.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)