Canic + OpenChat - my Astra experiment

Hey!

The OC architecture is actually about to change significantly.
We currently have 1 canister per user and 1 canister per group/community.
But this is no longer viable, because canisters now charge a base fee of ~0.4T per year (since mid June).
OC has roughly ~250k canisters, meaning it now spends 100k T cycles (100 quadrillion!) a year just on the canister base fees.

For years we have been unable to grow, because each new user costs 0.5T to create + ~0.5T initial cycles + regular top ups as needed.
So we have devised a MultiUser canister model which is now ready to launch.
We aim to start migrating users over to MultiUser canisters starting tomorrow.
Each MultiUser canister will likely hold ~10k users.
So rather than 250k user canisters we’ll have ~25.

OC’s cycles are managed via the single CyclesDispenser canister.
This canister holds ICP which it burns whenever its cycles balances drops below the configured threshold.
The top level canisters (UserIndex, GroupIndex, Registry, etc.) can each request top ups as needed.
The CyclesDispenser also checks the balance of all canisters registered with the SNS every 24 hours and tops them up as needed.
User/Group/Community canisters each check their balance upon executing update calls and they request top ups from their LocalIndex as needed (there is one LocalIndex per subnet).
Additionally, the LocalIndexes do a sweep of their child canisters each week to top them up as needed.
Using this model, canisters that are busy will get topped up as needed, and canisters that are idle get topped up by the weekly sweep.

Upgrades work in a similar-ish way.
We push the new wasm to a top level canister which relays it down to each of the LocalIndexes, which each then iterate over their child canisters applying the upgrade.

These top up and upgrade systems have been working smoothly for years and all of it is fully controlled by the SNS.
And with the upcoming reduction in number of canisters they will become even easier to manage.

Also, an important feature of this model is that inter-subnet calls are minimised.
Each LocalIndex canister only tops up, upgrades and creates child canisters on its own subnet.

I think it would be very hard for a generic system like Canic to improve upon this setup given the specific requirements of OC. But we’re always keen to improve OC and are open to new ideas.