Lag - What Is It?
People use the term a great deal, but usually without really understanding what it means, what causes it or how to deal with it. Some of the things commonly suggested to reduce lag actually have little or no effect.
First off, “lag” is a catch-all word that actually covers three very different things, and it is important to distinguish between them. Most lag reduction methods only deal with one of these three aspects.
You can use the Statistics Bar to get detailed information of what might be causing lag.
Network Lag
This is when you have connectivity issues. There are problems somewhere in the network between your computer and the LL servers. This usually can be noticed when you start to experience packet loss. Press Shift-Ctrl-1 (or Advanced1)→ Performance Tools → Statistics Bar) and look at the top, packet loss; ideally this should be 0%; if it isn't, you have a connectivity issue and are losing data. Also, check Ping SIM. Ideally, this should be under 200.
Symptoms of a poor connection include (but are not limited to):
- failure of your avatar or textures to rez;
- object information not displaying in hover tips when you mouse over the object;
- teleport failure;
- random disconnections.
You can try to mitigate network lag by playing with your bandwidth. Too high, or too low, a value will result in network lag. For information on how to determine your optimal bandwidth, refer to this page.
Aside from the network issues mentioned above, some programs may inhibit or interfere with a good connection. Some firewall software and anti-virus programs are known to do this. You may want to temporarily disable them and see if the situation improves.
Client Side
Everything you see has to be drawn by your graphics card. When there is too much to draw, when your computer cannot keep up, you experience client-side lag. Avatar Complexity (formerly called Avatar Render Weight or Avatar Rendering Cost) is part of client-side lag.
Symptoms of client-side lag include jerky or sluggish movement.
There are many things you can do to reduce this, without having to ask people to adapt to you:
- reduce your draw distance (do you really need to see 512m away?);
- Decrease max non-impostor avatars in Preferences → Graphics → General, which makes drawing of distant avatars much faster;
- disable atmospheric shaders (which serves to drastically reduce how much your computer has to render, as the sky alone is very graphics-intensive);
- if need be, inhibit the rendering of other avatars: Advanced → Rendering Types → Avatar - or derender them.
- try reducing your level of detail settings for everyday use or to improve performance: Preferences → Graphics → Objects and Sculpts LOD; you can always adjust this setting again temporarily if something specific fails to render for you.
Client side lag is local to you. It is a direct result of how powerful your computer is. It is no one else's fault if your computer cannot handle a specific situation. So if you're in a high-lag setting, adapt temporarily as described above.
It must also be pointed out that client side lag does NOT affect things like scripts, at all. It has next to zero impact on a SIM's performance.
Particles
Contrary to popular belief, particles do not “lag a SIM'. Their effect on a SIM, on the servers, is in fact close to zero. Particles are almost entirely client-side. They are rendered on your computer, by your graphics card, and in fact, do NOT require a script to keep them going. They need a script to initiate the effect, yes, but afterward the script may be removed and the particle effect will keep going forever - until another script is dropped in to turn them off, or the object is taken or deleted.
If you find that particles are “lagging you”, it is wrong to ask that the effect be stopped. Instead, stop it yourself, on your own computer. That way others who are less affected may continue to enjoy them.
You can disable particles in a number of ways:
- Advanced → Rendering Types → Particles
- Preferences → Graphics → Max. particle count - set to 0
Doing any of these things will stop particles “lagging you”. There is no need to ask others to degrade their SL experience on your behalf. Also, again, particles do NOT cause server-side or script lag. Even if the scripts are not removed, a single one uses 0.02ms script time.
Owners of venues that have a “no particles” policy may mean well, but are misinformed. Again, particles do not lag a SIM, and are very easily dealt with client-side as described previously. Those venue owners are aiming at the wrong target in trying to reduce lag: particles aren't it, scripts are - and even more so, moving avatars (see below). You can't remove the avatars, of course, but you can request that they not show up with heavily scripted attachments.
(Having said that, every little bit helps when it comes to reducing script lag, so if you have a particle effect that does not require the script to be in it at all times, remove it.)
Complexity
Like particles, high avatar complexity does not lag a region; the effect is entirely client-side. The higher the complexity, the greater the client lag it causes. Be aware of your own complexity, so as to try to reduce the lag you cause for others.
Region / Server Side
Server-side lag is caused by several things, independently. There are two major causes; all others are secondary and negligible. They are, in order of impact on a SIM:
- Physics. People, even wearing nothing at all, with a low complexity, and no scripts, will lag a SIM. The SIM needs to keep track of where each avatar is, to prevent them walking through one another, floors, walls, etc. Avatar movement is very high when it comes to server side lag. Sitting down reduces this lag significantly. Your avatar, in fact, becomes linked to the prim you're sitting on.
- Scripts. This is common knowledge, compared to the previous point. If you know you're going to a busy event, then remove scripted attachments, as many as possible. An AO in and of itself is negligible when compared to hair that is resize-scripted. Keep the AO, and instead ensure that your hair, shoes and other attachments have no resize scripts in them. Detach all HUDs which you do not actually need. (There is no good reason whatsoever for anyone to be carrying around more than 200 scripts on a human avatar, even when in full RP attire, with combat HUDs.)
Contrary to popular belief, prims do not lag a SIM - or more precisely, their effect on lag is miniscule compared to the two things mentioned above. Scripted prims cause lag; unscripted ones do not - relatively speaking, of course.
So, if you're going to an event, before you leave for it, check your attachments (hair, shoes, etc.) to ensure that they are unscripted. To those running events, it is strongly suggested that you ask attendees to do these things; a badly lagged SIM affects everyone at the event.
NOTE: As stated earlier, lag caused by physics (primarily avatar movement) is the number one cause of region lag. If physics lag is bad enough, scripts simply will stop running; avatar movement is considered more important than scripts. If there are 40 people at an event, and many are moving about, it will be laggy even if none of those people are wearing scripts.
NOTE: Moving away from a scripted prim will not do anything to reduce the “lag” it may be causing you. Scripts all run on the region server, and therefore, they are “global” to the server. No matter where you are in the region, the effect of that script running - that is, the time taken to run it, and the memory it consumes - will be felt on the entire region.
If you want more detailed information on checking for region lag, read on.
Diagnosing Region Lag
In order to understand region lag better, it helps to have a basic understanding of what is going on.
The simulator software that runs SL regions loops through a sequence of steps, during which it handles the following, among other things:
- avatars moving around
- physical objects
- scripts
Each time it goes thought the loop, it spends a little time dealing with each of the above: are avatars walking? If so, update their position, make sure they're not trying to go through a wall, and so on. For scripts, give each script a bit of time to run.
This loop is called a frame and runs, or should run, 45 times every second. That means that each iteration of the loop lasts 22.2ms, and that is the total frame time.
You will need to open the Stats window with Shift-Ctrl-1 for this.
Look for Simulator, near the top. click to expand if it isn't. Time Dilation basically says how long 1 second is in the region. Ideally, this should be 1.000, but normally can drop to 0.0097. The smaller the number here, the more lag there is. Then, look at SimFPS and Physics FPS. In a healthy region, these should both be 45.0 (there's the 45 mentioned above, the number of times a second the simulator software executes its loop). If these drop below 45, then the simulator software is unable to run all 45 iterations per second; it is lagged.
Now scroll down to the bottom, to Time; click to expand, if it isn't. This shows how much time is taken by each of the tasks the simulator needs to do in each Frame (for info on what each value means, refer here).
Total frame time should be 22.2ms, ideally (remember, that's how long each frame runs). The first value to look at is Spare time. This tells you whether the region is lagged or not. The higher the spare time, the better. If you have 0.001 ms here, then the region is lagged.2) The values between Total frame time and Spare time will give an indication of what is causing the lag. For example, high script time will mean that the region has script lag.