Running Containerized Microservices on AWS
Introduction
microservice characteristics:
• Componentization via services
• Organized around business capabilities
• Products not projects
• Smart endpoints and dump pipes
• Decentralized governance
• Decentralized data management
• Infrastructure automation
• Design for failure
• Evolutionary design
twelve factors app:cover four key areas: deployment, scale, portability, and architecture:
Codebase - One codebase tracked in revision control, many deploys
Dependencies - Explicitly declare and isolate dependencies
Config - Store configurations in the environment
Backing services - Treat backing services as attached resources
Build, release, run - Strictly separate build and run stages
Processes - Execute the app as one or more stateless processes
Port binding - Export services via port binding
Concurrency - Scale out via the process model
Disposability - Maximize robustness with fast startup and graceful shutdown
Dev/prod parity - Keep development, staging, and production as similar as possible
Logs - Treat logs as event streams
Admin processes - Run admin/management tasks as one-off processes
Componentization Via Services
Organized Around Business Capabilities
Products Not Projects
Smart Endpoints and Dumb Pipes
Decentralized Governance
Decentralized Data Management
design pattern can be used in microservice:
• Proxy – Helps provide a surrogate or placeholder for another object to control access to it.
• Visitor – Helps represent an operation to be performed on the elements of an object structure.
• Interpreter – Helps map a service to data store semantics.
• Observer – Helps define a one-to-many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically.
• Decorator – Helps attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to sub-classing for extending functionality.
• Memento – Helps capture and externalize an object's internal state so that the object can be returned to this state later.
Infrastructure Automation
Design for Failure
Evolutionary Design
design pattern can be used in microservice:
• Sidecar extends and enhances the main service.
• Ambassador creates helper services that send network requests on behalf of a consumer service or application.
• Chain provides a defined order of starting and stopping containers.
• Proxy provides a surrogate or placeholder for another object to control access to it.
• Strategy defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from the clients that use it.
• Iterator provides a way to access the elements of an aggregate object sequentially without exposing its underlying representation.