Motoko actor class deployment options

I have an issue where I have a few actor classes that I want to deploy from my main canister but I am running into an issue where each actor class takes about ~500KB of WASM space, so im looking into alternative options. Here is what I see as options

  1. Spread out the actor classes to other canister(s)
  2. Deploy actor classes from dfx (This might have an issue of not being deployable via a DAO)
  3. ?

Any help or suggestions would be appreciated

  1. Create a factory actor for each class.
  2. Give your main canister admin on it.
  3. Call the factory and have it create the canister, add your main canister as a controller and hand you back the principal.

This will be a tad slower, but your main canister will only need references to Interfaces for your canisters instead of having all the canister/system code in binary repeated over and over.

2 Likes

Interesting. I like it
Have you implemented something like this?
Seems like it would work for my scenario

1 Like

I originally developed it because my test Actors would blow up to a huge size when trying to test complicated scenarios. It works great for that and I would imagine it working well in production, especially for something like you’re building where you’re going to have a bunch of different kinds of canisters all working together.

1 Like

@skilesare do you have any tips for how to cleanly give a factory canister the main canister principal?
I always seem to have a cyclical reference issue with Main ↔ Other Actor. I dont like hard coding the value, which works, but isnt great. Also I have thought of the idea of having to initializing it post deploy, but that isnt perfect either.