Still remember design patterns in OOD? The gang of four. So what are the patterns in container architectures?
A shared vocabulary can enable us to understand each other quickly.
Quorum Protocol Gossip Protocol, Vector Clocks
Horizontal Scaling, Vertical Scaling Components scale independently Stateless Services Distributed Hash Table
Resource Isolation, Web-Serving Environments Auto Service Discovery, Service Brokering A breaking API Change Transient Failures
- The Sidecar Pattern: see more
The sidecar pattern can help to:
- Adapt legacy applications where we no longer wanted to make modifications to the original source code.
- Create modular utility containers that standardize implementations of common functionality.
e.g: Hands On: Deploying the topz Container
More explanation about sidecar pattern in book:
<Designing Distributed Systems>
- The Ambassador Pattern: see more
Ambassadors can alter and broker how an application container communicates with the external world.
e.g: Using an Ambassador to Shard a Service
e.g: A service broker ambassador creating a MySQL service
When trying to render an application portable across multiple environments, one of the primary challenges is service discovery and configuration.
- The Adapter Pattern: see more
The adapter container is used to modify the interface of the application container so that it conforms to some predefined interface that is expected of all applications.
It takes a heterogeneous world of applications and creates a homogeneous world of common interfaces.
We can use adapter pattern to support monitoring or logging for hybrid modules/components.
e.g, prometheus monitoring, nagios plugins for application monitoring, etc.
e.g, logstash normalizes different logging formats.
Downsides of microservices approach:
- More difficult to debug. Debugging in one process is impossible now.
- More difficult to design to enable proper services’ coordination.
- Performance downgrade: more players get involved in the communication/cooperation.
Common Tech Stacks
- MVC: models, views and controllers
- JAVA SSH: struts, spring and hibernate
- LAMP: Linux + Apache + Mysql + PHP
See more in wikipedia
- LNMP: Linux + Nginx + Mysql + PHP
- MEAN: MongoDB + Express.js + AngularJS + Node.js
Trouble With Distributed Systems
- Faults and partial failures
- Unreliable networks
- Unreliable clocks
- Communication and misunderstandings
- Single responsiblity principles: A class or method should have only one reason to change
- Open-Closed principle: A class should be open for extension but closed for modification
- Liskov substituion principle: Classes that implements the same interface or base class can be substitued
- Interface segregation principle: Interfaces should be specialized but not too special
- Dependency inversion(Inversion of control): Depend on abstractions not implementations
YAGNI Principle: you are not gonna need it yet
Original URL: https://architect.dennyzhang.com/design-container