Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Which causes less server load?

Ryas Fizir
Registered User
Join date: 7 Oct 2006
Posts: 15
12-30-2006 16:45
Which of the following would cause less of a server load:

1) A single prim with a 0.5 second Timer event making 2 llMessageLinked calls during each tick, or

2) 3 prims, each with 0.5 second Timer events, but making no llMessageLinked calls at all.


Basically, I have an object where 2 prims do something exciting and the root prim manages it all. I'd like to code the object to be as server-friendly as possible, but I don't know which method that would be.

Any help?
-Ryas
Malachi Petunia
Gentle Miscreant
Join date: 21 Sep 2003
Posts: 3,414
12-30-2006 16:57
In principle, a script should never get a single cycle while waiting for a timer to fire. I actuallity, I don't think that has been shown to be true.

Does the "master" always send two messages when its timer() event is called? If not, having a master on a timer would probably use less than three timers because the three scripts are only leaving their idle state when needed. You'll also get better synchrony with the master as the llSetTimer sets a minimum bound on the time before timer() is fired, and three clocks would probably drift over time.

My intuition is that the code simplicity would swamp any minor differences in event structure.
_____________________
Ryas Fizir
Registered User
Join date: 7 Oct 2006
Posts: 15
12-30-2006 20:07
From: Malachi Petunia
Does the "master" always send two messages when its timer() event is called? If not, having a master on a timer would probably use less than three timers because the three scripts are only leaving their idle state when needed. You'll also get better synchrony with the master as the llSetTimer sets a minimum bound on the time before timer() is fired, and three clocks would probably drift over time.


Yes, the master prim always sends two messages during the timer() event.

If I were to use three timer() events, all three would run to a set period of time, using llGetGMTclock(), so they would all turn off at roughly the same time (depending on how accurately the timer event is behaving). And it's not necessarily important to have exact split-second timing between the prims.

The "flow" of my object's behavior seems smoother using three clocks, rather than using one clock and llMessageLinked(). But the code is cleaner the other way. I just wasn't sure if one method produced significantly more server load than the other.

Thanks for the help.
-Ryas
Zaphod Kotobide
zOMGWTFPME!
Join date: 19 Oct 2006
Posts: 2,087
12-31-2006 04:32
Setting a timer event in and of itself is relatively low cost. You're just specifying a slice of time after which your script is going to do a specific set of instructions. I would think that the "server load" question only really comes into play when the code inside the timer() event itself is executed. With option 1, you are adding an additional function call just to tell the other scripts to do something. With option 2, they just do it. I don't think there is much optimization to be done until the timer actually fires and you start doing stuff.
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
01-01-2007 12:16
If possible you want to average the sim loading by using non exact timer numbers. Keeping peak Sim loading down helps.
Zaphod Kotobide
zOMGWTFPME!
Join date: 19 Oct 2006
Posts: 2,087
01-01-2007 13:28
From: grumble Loudon
If possible you want to average the sim loading by using non exact timer numbers. Keeping peak Sim loading down helps.


Hadn't thought about that, but it makes good sense!