Print

Preventing Lag in Second Life

Written by Saii Hallard. Posted in Second Life Support

What is Lag?


To me, lag is latency. When we used to have modems to play games with someone else, like quake and duke nukem, there could be a substantial delay between the action of the other and for you to actually see it on your screen. So, latency is the delay it takes for data to be send to the server, and distributed to others so they can see what's happening. Therefore using the term lag for graphics stutters and the inability of the Second Life servers to compute scripts, avatars and physics is in my opinion wrong.
Lag description on Wiki

However, since lag is a popular term in Second Life, I will use the term from here on to describe what should have been called performance issues.

 

Regions and Sims

Another misused word is sim. Most people call a region a sim. However a sim(ulator) is the hardware host or node that run 4 or more regions.

A region is a square on the map in Second Life with 256x256 sqm land, which can be subdivided into parcels.

Each parcel can have its own settings for permissions, music, sound and video.

 

Region Health

To determine how healthy your region is, press SHIFT-CTRL-1. It will bring up the statistics window, shown in image 1.
Note the green circled numbers, those are the distributed timings to everything that is needed to have the region running.
If the red circled number (spare time) is a positive, then it means the region is healthy and can have avatars without experiencing lag.
The higher number the better of course.

If you have no spare time available in the region, then you have to start searching what is causing it. Logical deduction is the key.

In most cases you will find that it's not scripted objects that are the cause, but avatars or even yourself. In one case I came to the conclusion that one avatar who was in the region took around 5ms of time, because she was wearing a (horribly scripted) spanker HUD and boots which contained 3 scripts per prim.
To take this into comparison: This avatar had the same script time as 36 fully active SHX Club Shoutcast receivers.
So, in conclusion: A few avatars can bring your region to a halt, if wearing the wrong stuff.

Statistics image 1

 

Preventing Lag


To prevent lag that would spoil the experience for your event and your visitors, there are a few things to consider when building your new place:

* Do not use 1024x1024 textures or pre-made objects/products that you suspect use a lot of these high resolution images. It is simple: these textures induce a lot of strain not only when downloading, but also from your graphic card. ( Image Sizes and Memory use ) [Client-side lag]

* Do not use objects that have scanners in them. It is hard to say how these things are made, since you cannot look in the scripts itself, but mostly have a sensor time of 1 second or below. This takes a lof of script time and therefore strains the regions performance. Examples are: visitor counters, Radars, spanker huds etc.
If you need a visitor counter for instance, take care to buy a good one. I have made and tested one that has a rate of 3 seconds, is optimized for lists and therefore will not strain the region script time.
[Server-side lag]

* Use particles with common sense. New pc systems will not have a problem with particles, but most systems will. If you see a particle effect that is very dense and if you zoom in on the effect and your screen starts to stutter when trying to zoom around, you then will know that this effect has a too high particle rate. In other words, it generates too many particles.
You have to see this as images. What the system does is nothing else but generating images, but at high rate. Adding to this that they always are alpha (transparent) images, they strain your graphic card. It is a client side problem, but often referred to as lag. [Client-side lag]

* Check your own avatar. After doing several tests, I have found that current clothing, huds and other things you wear on your avatar can drag the region performance to a halt. Some examples are: Spanker Hud with radars (this one is particular very badly scripted), Boots or other prim clothing with resizing scripts (imagine having 3 scripts in every prim, where boots mostly come in 4 parts and having 254 prims each, that sums up to 3048 scripts!, then imagine each of those scripts listen to the chat channel for changes, it is insane)
Of course you can't check and strip someone else, but at least you can take care of yourself.
[Server-side lag]

* Do not use "temp-on-rez" rezzers. Advertised to use more prims then your parcel can use. But in essence it just places an object with the temporary-flag (which is meant for bullets from a gun for example). Since it is temporary, it needs to do this every minute. I don't have to explain this has a big impact on the regions performance. [Server-side lag]

* Try to avoid using physical objects just to show, like those insane toy animals ( I will not say the name, but most of you know what i mean ) or objects that make use of the puppeteer script intensively. If something is moving at a high rate (not smoothly rotating), it is most likely bad for the region. Changes are that it will not register as bad in the top scripts window, since it changes so often. Just use common sense and a close eye on the statistics window. The top scripts window is inconclusive and since the introduction of mono does not give accurate figures at all. [Server-side lag]

*  Use common sense. If you build a club to show off, please add many light effects and moving things. But if you build a club to entertain visitors and have fun playing your music, try to minimize. I know this is odd to say as someone who sells club products, but using less is better for the overall experience.
Personally I run quickly from clubs who use light systems and dancefloors that seem to have made a comeback from the 70's and should have a warning to cause seizures when looked at for longer then 5 minutes.

 

Region hardware & software

it is known that the Second Life system shares 4 or more regions on one piece of hardware. In time the hardware has been upgraded and so is the balancing (from what I can tell). This means that the rumour that another region could have an influence on your region is not an issue, since it seems to have been balanced well. 

Software however remains an issue, where ghost scripts (object scripts that stay in memory after being deleted) slowly deteriorate your region.
Resetting the region on a regular basis is advised.

 

Other references

Lag - Second Life Wiki
How to reduce Lag - Second Life Wiki

Yours truly, Saii Hallard.