Clarity on compute-allocation

Does the compute-allocation fee listed here ic/subnet_config.rs at master · dfinity/ic · GitHub apply at execution time or does accumulate while the canister is “at rest” as well (like the storage fee).

TL;DR Compute allocation fees accumulate over time because they control how often your canister has priority to be scheduled first. Once the canister is scheduled for execution, compute allocation makes no difference to the execution engine.

A bit of background on the deterministic scheduling algorithm: let’s assume that we have N cores and M canisters that have some inputs to process.

If M ≤ N, we assign each canister to a separate core and let them process messages until they run out of inputs or reach the per round cycle consumption limit.

Things become more interesting if M ≥ N. In this case some canisters will have a priority and some will have to stand on the 2nd, 3rd, etc. position in the execution queue for each core. They will only have a chance to execute if the first canister runs out of inputs.

The scheduler uses compute allocation and some historical data to decide which canisters should go first in the line. Higher compute allocation means that your canister will have priority more often (e.g., compute allocation of 60% means that your canister will be first in ~60% of the schedules, given that it has enough inputs).

I hope now it makes sense that compute allocation fees accumulates over time. It works as “ad boost” feature.

8 Likes

Thank you so much! This is a huge help.