> Home > ADRs > ADR-007 Use hybrid architecture
Date: 2022-06-01
Confirmed
In our Architecture Characteristics Analyses we have identified following architectural characteristics:
- Simplicity *
- Cost *
- Domain partitioning
- Scalability *
Ship the product to the market first.
Different architecture styles we have considered:
Monoliths is a system in which all the code is deployed as a single process
Positive:
- Cost
- Simplicity:
- Single repository
- Single CI/CD pipeline
- Single set of infrastructure
- Easy to handle DB transactions
- Easier to change
Negative:
- Big bal of mud
- Tight coupling between functionalities
- No domain boundaries
- All code is globally accessible
- Need to understand the entire codebase
As a subset of the single process monolith, the modular monolith is a variation: the single process consists of separate modules, each of which can be worked on independently, but which still need to be combined for deployment. In a modular monolith, the architect partitions the architecture around domains or workflows rather than technical capabilities.
Positive:
- Cost
- Simplicity:
- Single repository
- Single CI/CD pipeline
- Single set of infrastructure
- Easy to handle DB transactions
- Easier to change
Negative:
- database lacks decomposition - we've mitigated this risk by decomposed database into separate schemas, logically separation
- can't scale indefensibly due to db connection limitations
Monolith to microservices, Sam Newman
The microkernel architecture style (also referred to as the plug-in architecture). This architecture style is a natural fit for product-based applications (packaged and made available for download and installation as a single, monolithic deployment, typically installed on the customer’s site as a third-party product).
Positive:
- Cost
- Simplicity:
- Single repository
- Single CI/CD pipeline
- Single set of infrastructure
- Easy to handle DB transactions
- Easier to change
Negative:
- Scalability
- Fault tolerance
- Elasticity
Fundamentals of Software Architecture
Microservices are independently deployable services modeled around a business domain. They communicate with each other via networks
Positive:
- clear boundaries between services
- deployed independently
- can be scaled independently
- free of tech stack
Negative:
- A five-person startup is likely to find a microservice architecture a drag.
- Bad choice for brand-new products
- Multiple repositories
- Multiple CI/CD pipelines
- Network overhead
- Complex cross-service transactions
- Expensive to change
Building microservices, Sam Newman Fundamentals of Software Architecture
We decided to take monolith-first approach, and add some bits and nuts of serverless for resource intensive tasks. To fully support all the requirements, we start from modular monolith with service-based architecture and decomposed database.
We will scale some services with serverless approach, that's how we bring hybrid approach to the application. For example, one of the most CPU-intensive and memory-consuming task will be PDF generation, so use of serverless stack here could help us a bit.
Positive:
- We are able to optimize and scale system
- We still keep monolith-first approach
- We can replace serverless with paid service later on.
Negative:
- Serverless would limit us in technical decisions, like databases used by serverless
- Cold-boot latency
- JSON for communication
- Technology stack will be from variety of programming languages, supported by cloud provider.
- We need to define "the margin call" costs for using serverless
Risks:
- Possible vendor lock-in with serverless
Bonus Features:
- "Infinite" scalability of serverless