3 ms·
For a startup - all this may feel OK like you're cheating the system and beating others to the punch - but damn, if you actually make it - good luck scaling tha
by scarface74 8y ago
For a startup - all this may feel OK like you're cheating the system and beating others to the punch - but damn, if you actually make it - good luck scaling that up.
Why is that a problem? I am speaking in C# terms...
Phase 1 Monolith: all of your code is one solution, with separate domain specific projects (assemblies) with separate namespaces with a logical use of access modifiers exposed as an interface. All of the other code uses interfaces as dependencies defined with a DI framework.
Phase 2: We need scale now. Bring up a lot more VMs at the click of a button behind a load balancer and you get scale quickly.
Phase 3: Take your project that you need to scale independently out of the monolithic solution, expose it as API, put that one API behind a load balancer. Then have a proxy class in your client and use your DI to map your interface to your proxy. If you integrate something like Swagger into your API, it can create the proxy class for you.
If you can deal with eventual consistency, use a queueing mechanism.
Rinse and repeat and keep taking projects out of the monolith as needed.
There will be some shared code you don’t want to run out of process. For that, create Nugget packages and you won’t have to change your client code at all.
- holtalanm 8y agoI was thinking something along these lines, as well. I recently learned of the IDesign Method, which seems to try to do something like this, with a standard architecture for handling scaling in a future-proof kind of way. Forgive me if my understanding of that architecture is wrong. I only have read parts of the book so far.
- scarface74 8y agoIt's basically Domain Driven Design combined with SOLID principals. If you have a Customer domain and an Order domain, as tempting as it is to join the two related tables in code, avoid it. Have another service (not http service/domain service) aggregate information from both domains. It's then mechanically trivial to split the Customer module and the Orders module both the code and the data store.
- merb 8y ago> There will be some shared code you don’t want to run out of process. For that, create Nugget packages and you won’t have to change your client code at all. actually you can keep your solution and just have many projects in one solution (monorepo)
- scarface74 8y agohaving one large solution causes a ton of issues. Even if you have multiple solutions in one repo, that means everytime you deploy, you have to deploy the whole thing. Rolling back becomes more difficult and one team can break the build and it effects other teams.
- merb 8y ago> Even if you have multiple solutions in one repo, that means everytime you deploy, you have to deploy the whole thing. Why? Just because the code sit's in one repo, doesn't mean that everything needs to be deployed the same time.
- scarface74 8y agoHow do you do independently automatic partial builds and deployments to an integration environment with a monorepo? If I just changed one solution, pushed it, and the build process is automated, how does it know not rebuild and deploy all of the solutions?