架構師訓練營 week10 總結
10.1 微服务:服务本身的设计、维护以及治理
monolithic problems
- Hard to complier and deploy 
- Hard to manage code 
- Database connection 
- Hard to add new features 
Web Service - Weaknesses
- bloated register mechanism 
- XML low-efficiency serializer 
- Slow HTTP connection 
- Complicated deployment and maintenance 
Microservice requirement
- Failover 
- Load balancer 
- High-efficiency Communication 
- the least injection for an original application 
- Versioning 

Service mesh


10.2 微服务:落地实践的策略与思路
微服務架構落地
- Business first, figure out business boundary and dependance first. Tech is a means, not a goal 
- independent module first, then distributed service 
- Seriously look into how to refactor high coupling and complicated system 
- What is the purpose? Reuse? Clear development boundary? Distributed system to enhance performance 
CQRS - Command and Query Responsibility Segregation
- Clear domain model 
- Can performance tunning for read and write 
Event tracking
- recover 
- monitor 
Breaker
- Error handling 

Service retry and timeout

The most important thing is requirement

10.3 微服务网关的技术架构
API gateway structure

- Unified access 
- Flow control and fault tolerance 
- Protocol adapter 
- Security 

Register center, consumer and service provider

No business logic, mainly focus on validation

async structure

- API interface 
- Protocol adapter 
- security 
- Audit: monitor, count 
- routing 
- Flow - hide internal detail, provide united interface 

Oauth2

10.4 领域驱动设计DDD
貧血模型 (anaemic domain model)
- Service 和 Dao 只有方法,沒有數值成員變量 

充血模型 (rich domain model)
- 包含了對象的數據和計算邏輯 

DDD 戰略設計
- 限界上下文:限界上下文和子域具有一對一的關係,用來控制子域的邊界,保證子域內的慨念統一性 
- 上下文映射圖:不同的限界上下文,也就是不同的仔細或模塊之間會有各種的交互作用,DDD使用上下文映射圖來設計這種關連 
DDD 戰術設計
- 實體:把握住實體的特徵是什麼,實體應該承擔什麼職責,分析時要放在業務場景和限界上下文中 
- 值對象:DDD推薦盡可能將對象設計為值對象 - 不變性 



10.5 软件组件设计原则
內聚原則
- 複用發佈等同原則 
- 共同封閉原則 
- 共同複用原則 
- 不是被共同依賴的類,就不應該放在同一個組件中 
耦合原則
- 無循環依賴原則 
- 穩定依賴原則 
- 穩定抽象原則 
- 穩定的組件應該是抽象的 
- 不穩定的組件應該是具體的 
10.6 案例:用领域驱动设计驱动系统重构















 
    
评论