0
0
Microservicessystem_design~12 mins

Why containers package microservices - Architecture Impact

Choose your learning style9 modes available
System Overview - Why containers package microservices

This system explains why containers are used to package microservices. Containers bundle the microservice code, runtime, and dependencies into a single unit. This makes microservices easy to deploy, scale, and run consistently across different environments.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
+----------------+    +----------------+    +----------------+
| Containerized  | -> | Containerized  | -> | Containerized  |
| Microservice A |    | Microservice B |    | Microservice C |
+----------------+    +----------------+    +----------------+
       |                     |                     |
       v                     v                     v
   Database A             Database B             Database C
       |                     |                     |
       v                     v                     v
     Cache A               Cache B               Cache C
Components
User
user
Sends requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to appropriate microservices
Containerized Microservice A
service
Handles specific business logic packaged in a container
Containerized Microservice B
service
Handles another business function packaged in a container
Containerized Microservice C
service
Handles a third business function packaged in a container
Database A
database
Stores data for Microservice A
Database B
database
Stores data for Microservice B
Database C
database
Stores data for Microservice C
Cache A
cache
Speeds up data access for Microservice A
Cache B
cache
Speeds up data access for Microservice B
Cache C
cache
Speeds up data access for Microservice C
Request Flow - 11 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayContainerized Microservice A
Containerized Microservice ACache A
Cache AContainerized Microservice A
Containerized Microservice ADatabase A
Database AContainerized Microservice A
Containerized Microservice ACache A
Containerized Microservice AAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Containerized Microservice A
Impact:Requests routed to this microservice fail, causing service disruption for that function
Mitigation:Use container orchestration to restart failed containers and route traffic to healthy instances
Architecture Quiz - 3 Questions
Test your understanding
Why are microservices packaged in containers?
ATo increase database speed
BTo bundle code and dependencies for consistent deployment
CTo replace the API Gateway
DTo avoid using caches
Design Principle
Containers package microservices to ensure they run the same way everywhere. This isolation helps developers deploy, scale, and update services independently without conflicts.