What is a reasonable amount of total script time for each type of region? The amount beyond which you’d start to see noticeable region performance degradation (sim lag) if we assumed each region on a processor is the same region type with the same total script time?
Running scripts is the lowest priority task for the server so it won’t usually affect other functions but that means too many scripts will cause script failures and that can be a problem in itself.
It’s also important to note that scripts can trigger lag events. HTTP requests will increase the Net Time, vehicle script are likely to add to the physics time and so on.
Also, launching new scripts can cause lag. When an avatar enters the sim, the server has to load all the script it carries with it and that will cause a short lag peak. If the avatar is heavily scripted, it may be a very high peak. Usually those peaks are too short to be significant but if it’s a sim where people keep tp’ing in and out all the time, it can become a serious issue.
In other words, even though script lag generally is a thing of the past, it’s still a very good idea to try to keep the script load as low as possible.
What is a “safe” amount of total script time?
Depends on what other tasks the server is kept busy with. If the total frame time is higher than 22ms, it’s an overloaded sim. If the spare time is less than a millisecond or so, the sim is pushed hard enough you must expect occasional glitches but not continuous poor performance.
I have to chime in here because there is some misrepresentation of the facts. While it’s true that while running, scripts run in “Spare Time” and won’t impact anyone directly, scripted attachments can still significantly impact a sim in many ways. As mentioned, scripts can trigger other laggy behavior based on what they do. Worse though, is when scripts are “moved” in and out of a sim. When someone TPs, all the scripts in their attachments need to be suspended and “moved” to the new sim. The code, the data, the current state for each and every script needs to be dealt with. There is the network impact of the actual transfer of that data, but also this triggers the Region change event, which will cause new HTTP connections / handles to be created for any script that needs them, etc. There is also the impact that instantiating the script has on the region’s script engine, accepting the data, scheduling, etc. etc. etc. There is a LOT that happens behind the scenes that is completely transparent to you. After all this stuff happens, things settle down and run smoothly again but for heavily loaded avatars it can take several seconds for things to calm down. Meanwhile, everything else in the sim will stutter. This freezing behavior can be seen when testing in an empty sim using an unscripted observer and a heavily scripted test subject, monitoring the region statistics. See what happens when both heavily scripted versus unscripted avatars TP in and out. It may surprise you.
Each server only has a fixed amount of real memory (RAM) for each region running on it. Each script takes “some” memory, the more scripts running, the more memory used by those scripts and the less is available to “other” things the sim uses memory for. Once a sim runs out of real memory, it uses virtual memory, which is going to be a crappy desktop-grade SATA drive (cause they are cheap.) This causes the sim to lag horribly as it’s swapping in and out bits and parts to and from the disk as needed to that Very Very slow storage. Once a sim starts swapping significantly, you pretty much have to do a restart. Scripts are not the only cause of low memory here, but they can be a significant factor in a busy sim.
There are some venues that will automatically eject people with lots of scripts. What they fail to understand is that by the time they count scripts on someone, it’s WAY too late. The damage is done and the sim is already calming down to be only very minimally affected by the avatar’s excessive scripts. I would NOT recommend those systems.
The bottom line though – if the scripts are in stuff on your sim, go for it. As long as they run smoothly, your good. Just be aware that things may start to behave badly when the laggy avatars hit.
My advice is to monitor your scripts and the avatars that come to your region. Restarting the region is a band aid in most cases and never gets to the root of the problem FAT AVATARS! that’s right I said it “FAT” I will write more on rendering cost and avatar scripts later on but the fact remains the same while most estate owners deal on a daily basis lag reports 99.9% of the time its due to “Fat” over scripted avatars.
More on this subject to come have a great week from all of us at ZI