If a tree falls in a forest and nobody can see it, does it still fire a collision event?
In Second Life(R) it does, and this is one of the reasons that the platform is so expensive – maintaining 20,000 regions requires 20,000 processor cores. Consider the WWW by contrast – a single server can power thousands of websites; because the cost of hosting is virtually free until someone accesses the site. Cost does not equate simulation space – it’s based on simultaneous concurrent accesses and the complexity of processing the requests.
OpenSim falls into the same trap in many ways – while the cost of hosting an empty region is nearly nil; there are two key aspects where processing will always continue even if there is no need or desire to do so. These areas are physics and scripting – arguably two of the larger expenses on the processor bill.
Physics can be limited somewhat – switching away from a persistent simulator (ODE) to something that computes physics ‘on demand’ (POS, BasicPhysics) will remove the expense of physics while no-one is in the region, but you lose the ability to have objects move independently. For those hosting geographical areas this may be perfect – if you don’t have any scripts in the region and compute physics purely on demand, you are looking at a raw cost in just memory – about 20mb per region, and even that can be paged to disk safely.
However, hosting conventional regions is a more tricky prospect – users have an expectation of certain features working, people use scripting and want to physically interact with objects. One of the options worth considering may be simply dialling the simFPS according to the number of viewers in the region. Drop down to 1Hz when there is no users, but dial back up to 45Hz when users appear – all easy enough to do within the codebase, however doesn’t reduce the processor cost to zero while inactive.
If we consider the ultimate goal being to reduce Virtual World running expenses to similar to that of a web-host: costs being per-access, measured in processor time, bandwidth, etc. then we need to go a few steps further. One of the bigger steps is reducing expectations – right now you can safely assume LSL will always be running, so therefor you can write things like “servers” in LSL. Servers are a good example of the problem – they are something that interacts with the world, but aren’t supposed to be part of it; yet they consume the expenses of being in the world all the same.
Servers could be much better replaced by simple web scripts or server daemons on a normal server – which have a decent API that can connect to the world and make their interactions without needing to be part of it. By doing so, you not only make the servers more efficient (Apache+PHP is faster and more powerful than LSL), but you reduce the persistent load on the world itself.
The work I am doing on MRM is addressing part of this problem – redefining the API to reduce the number of scripts you need in the world, but a total solution here includes some kind of “remoting-style” API that lets you send messages and interact with the world, from a completely independent outside authority. The other side of the same coin is reducing ‘background noise’ processing – timers, sensorrepeats and other recurring tasks all place a small but visible background load on the server, all of these events will keep the server processing even if there is nothing to do.
Some things may require this – but encouraging people to think about when they need these events is better. Limitations on the LSL API really prevent this in SL, but in OpenSim would you be willing to use a “TimerIfAvatarInRegion” instead of a plain Timer? If you could – then it would allow the back-end server to attach conditions to your scheduler which provide optimisations when no-one is there. Allowing these kinds of optimizations is going to be key in the long term – because a cost of one processor core per four concurrent users is just simply insane and will never be adopted in the wider marketplace VW operators hope to gain. If webservers could only handle four simultaneous users – Google would require millions of servers to operate instead of just thousands.


Very nice article.
Personally i love the google comparison in the last sentence.
I even believe, that besides the hot standby solution you did describe there will be a market for cold standby (like sim on demand) and warm standby (have a virtualization os some kinde – fire the virtual server on the first incomming avatar).
That solution wich are “protocol aware” will be coming up is is something the badumnasim proxy does allready show. there is a proxy for opensim now, there is none for Second Life.
cheers,
Ralf
Ralf Haifisch
11 Apr 09 at 8:13 am
regarding TimerIfAvatarInRegion.
Would it be feasible to specify a conditional parameter such as SleepWhenEmpty, or even a parent class that unschedules whole programs when no agents are present. Maybe even make that the ‘default script’ so that newer, less experienced creators have to learn how to make a program persistent even if no person is present.
Tony
13 Apr 09 at 2:38 pm
There’s a bit of a balance between a nice easy to use API and making sure people dont do silly things with it.
My thoughts are probably leave the ‘defaults’ on the timer handler as “undefined”. A server operator can set the defaults – if a script needs to do things persistently, then it has to expliticly ask for it.
I’m not sure if I committed IScheduler yet, however that will take the form of the Timer handler – you schedule future operations via a scheduler, which then slots you into a processor timeslot with conditions. Empty sims are one of those conditions, as are a few others (performance above X for instance).
Adam Frisby
13 Apr 09 at 2:56 pm