• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Testing server performance

rafaeru

Active Member
Joined
Mar 6, 2013
Messages
134
Solutions
10
Reaction score
29
Location
Poland
GitHub
rafaeru97
Hello, im working on my ot from longer time and i have certain question. Namely do you know any ways to check which lua scripts are the least efficient ?

For expample, from experience I noticed that sending a lot of magic effects / animated texts for all online players causes felt lags.
What are your ways to find out what is causing lags?

I know i can turn all scripts off and turn on them one by one but problem is in simulating e.g. 200 players on which this script will affect.
I would like to rewrite the least efficient scripts into source to achieve the best server performance.
What do you think about this?
 
Last edited:
I would like to rewrite the least efficient scripts into source to achieve the best server performance.
that would not help at all in most cases..., and yes, scripts that deal with iterating with all players and timers will mostly be the ones that will cause "lag", and btw you gave us no info at all, like server version (not tibia version) and the hardware (and OS) that it will be hosted


and here are some useful links:

and also an optimized tfs in case you don't wanna to worry:
 
My question is totally theoretical how you deal with it because I pick out something for myself.
 
you can benchmark them with os.clock..

e.g:


local benchmark =os.clock()

-- your script here

print(os.clock() - benchmark)

In your console it will output the time that the code took to run. Higher values mean the script is too demanding.

You can also make this more generalized in the cpp to whenever you're calling a script in Lua, you benchmark it. Storing benchmark results, taking the mean and outputing later the event called and it's mean time to run may be a good idea. Just remember that sometimes an event is called but returned before running entirely, so the meantime wouldn't be a real value.
 
you can benchmark them with os.clock..

e.g:

local benchmark =os.clock()

-- your script here

print(os.clock() - benchmark)

In your console it will output the time that the code took to run. Higher values mean the script is too demanding.

You can also make this more generalized in the cpp to whenever you're calling a script in Lua, you benchmark it. Storing benchmark results, taking the mean and outputing later the event called and it's mean time to run may be a good idea. Just remember that sometimes an event is called but returned before running entirely, so the meantime wouldn't be a real value.
Thanks, I give it a go to figure it out.
 
Back
Top