How resource priority is used

We have already said that a resource binding with a higher priority (higher number) is a request to prefer re-use of such a resource instance. But how are these preferences actually calculated?

Suppose our application requires resource classes \( 1,\ldots ,n \) with re-use priority \( P_{1} \) , ..., \( P_{n} \). Then a resource handle (i.e. one previously used and still contracted to us, but not currently in use by one of our netlets) gets a score of \( W_{1}P_{1}+\cdots +W_{n}P_{n} \) where each \( W_{i} \) is a weighting as follows:

Beatrix picks one available resource handle and scores it against each node in the hosting service. The resource handle reused on those for which it has the highest score, and its resource instances get reused where possible. If there are no available resource handles then a completely new one is created, with all fresh resources.

Beatrix does not try to split up old resource handles to create a new one with a possibly higher score, nor does it try any resource handles beyond the first one it finds. But whatever happens we get a resource handle with resource instances from all the resource classes we described, whether they are new instances or not.

For example, suppose our application requires disk with priority 8 and net with priority 10, and Beatrix has a resource handle potentially for use on nodes N1, N2 and N3. N1 needs a new disk instance, but the net instance is connected to that node. It gets score \( (8*0)+(10*2)=20 \). N2 has the old disk space still connected on that node, but the net instance could be moved back from N1. It gets score \( (8*2)+(10*1)=26 \). Node N3 has none of the old disk or net instances, which need to be created anew. It gets score \( (8*0)+(10*0)=0 \). Node N2 wins the resource handle.

Nik Silver 2002-03-09