What is the max acceptable server script activity %? Why?
I think this is a bit of a broad and subjective question.
A server script may have a lot of activity because its in constant use, I have had scripts at 900000 activity dedicated (by measure of total time in ms) due to it having to handle 120 clients at once whilst also ahving a very high activity - game wasn’t lagging it was just a moving body script which adjusted to player cameras.
You would be better either:
- evaluating it yourself, does it seem to be doing too much activity for no reason?
- look into time complexities for functions, if it has a high time complexity then maybe you might want to cut the script down (if possible).
Having 100% activity just means its on all the time, this isn’t necessarily bad but it could mean its doing unnecessary operations.
When you say that you’ve had scripts at 900000 activity, I’m having trouble understand how it’s possible to exceed 100%?
If you read the () it says “by measure of total time in ms” dedicated to that script. 15 minutes is a lot of time to use up in a server (to do calculations).
% wise for activity that would be near to 100% in use anyway, as its constant movement.
Is there a way to tell if the server is throttling threads due to lag then?
Well the easiest way to test performance really is through play tests and generally checking script activity, you should also check if the lag is coming from your graphics and not the scripts (this is more prevelant when you have loads of textures - you’ll notice the game doesn’t lag when your not facing these areas).
Genuinely I would just measure the time it takes to do operations by subtracting tick() from a start value, and then working out how many times it does that operation. If its running smoothly at good graphics on your client though, chances are you could add another 5-40 people with little effect. As players increase beyond that, servers tend to struggle more generally.
Good thing to note:
- when you create a script you essentially create a thread, the more threads you have continuously doing processes the lower the performance.
To make a server throttle though you have to be doing some extreme stuff in some respect:
- complicated maths,
- difficult rendering,
- millions of print statements,
- forgetting a wait().
This is something I was wondering. Ive always been told to keep server scripts below 3% activity if its under a heartbeat but what happens if i split said script between server scripts so say for example i had one hitting 3, if i split what the server script did into two scripts and it was running at 1.5% each then does that mean the server will be throttled less or the same?