VideoCoin Network Worker Selection Algorithm Explained

Vivid Labs Team
VideoCoin
Published in
2 min readMay 27, 2020

How VideoCoin Network Selects a worker to get work assigned.

VideoCoin Network is expected to have a lot of workers, both big and small. This means that workers need to be chosen from a pool to make sure that they are qualified and have the capacity to finish the work sent to them.

Here is how this process works (in a simplified explanation).

Capacity Benchmarks

Capacity Benchmarks provide an insight into how much performance a worker node has available. Covered in our previous posts like this one.

Capacity Benchmarks are run on the worker node in the following cases

  1. First time the worker comes online [During setup process]
  2. Every benchmarkRepeatDuration [configurable, set at 15 Minutes for Everest]

Capacity Benchmark will have different values provided as a result based on node capacity. For example, there can be encodeCapacityBenchmark, analyticsCapacityBenchmark, storageCapacityBenchmark etc.

Encode Capacity Benchmarks

Selection Algorithm

The selection algorithm is based on a weighted random selection algorithm, where a set of qualified nodes are weighted on their totalStake before selecting.

Step 1: Find Qualified Workers

Step 2: Select a random worker weighted by totalStake

Example:

Assume the following constants

minEncodeCapacity = 20

maxCurrentCPU = 20

Assume ALL available present worker pool is as follows.

Step 1:

Find qualified workers where minEncodeCapacity > 20 and currentCPU < 20 and sort by stake

Pool of qualified workers will be:

Step 2:

Calculate weights:

worker.weight = worker.totalStake / currentQualifiedStake

Step 3: Selection

Generate a random number between [0, 1] select a worker based on the weighted select algorithm above

For the following random numbers, the worker selected will be as follows

If you are interested to learn more about this topic, you can check the following links

--

--

Vivid Labs Team
VideoCoin

Creators of VIVID, the next generation NFT publishing platform that allows anyone to create, manage, and sell multimedia NFTs.