SlideShare ist ein Scribd-Unternehmen logo
1 von 32
MicroService Architecture 
@Ctrip 
William Yang(杨波) 
Dev Manager & Architect 
@Ctrip.com
Problem Domain 
• System decoupling for deployability and 
scalability 
• Evolutionary architecture and adaptive 
organization 
• Mobile Backend Architecture
Agenda 
• The curse of the monolith 
• Case study – decomposing Ctrip mobile 
backend into microservice 
• Microservice best practice 
• What we have learned
Initial Ctrip Mobile Backend 
Architecture 
Monolithic Mobile Service 
SBU A SBU B SBU C SBU D 
SOA/ESB
Pros & Cons 
• At the beginning … 
simple to develop, test, deploy and scale 
• Later … 
huge, complex, monolithic mobile service
The Curse of the Monolith 
• Bloated codebase 
• Communication and coordination cost 
• Obstacle for frequent deployments 
• Little resilience to failure 
• Commitment to a single technology stack 
• Hindering innovation
MicroService Architecture Style 
• Decomposing a single app as a suite of services 
• Communicating with lightweight mechanism 
• Built around business capabilities 
• Independently deployable 
• Minimum of centralized management 
• May be written in different programming 
languages and use different storages 
http://martinfowler.com/articles/microservices.html
Who has Migrated to MicroService 
http://microservices.io/patterns/microservices.html
New Mobile Backend Arch @Ctrip
Key MicroService Infrastructure 
• Service 
– Service framework, gateway, registry 
• Monitoring 
– Logging, tracing, metrics 
• Deployment 
– TEST/UAT/PROD environments 
– CI/CD 
• Push common concerns to technical 
infrastructure
MicroService Framework @Ctrip
Service Metrics Monitoring
MicroService Availability 
• Assume a monolithic service with 99.99% 
availability, what if you have ~30 microservices 
each with 99.99% availability?? 
• Combined effective availability 
== 2 HOURS of downtime per month 
== 99.7% uptime!!
Service Dependency
Single Dependency Delay
Cascading Failure at Peak Hour
Basics of Service Fault Tolerance 
• Circuit Breaker(Fuse Blow) 
• Isolation 
• Rate Limiting 
• Fallback
Hystrix Circuit Breaker 
http://github.com/netflix/hystrix
Ctrip Gateway Hystrix Dashboard
MicroService Gateway
Gateway Filtering Mechanism 
“pre” filters “routing” filter(s) “post” filters 
Origin Server 
“error” filters 
HTTP Request 
Http Request Http Response 
https://github.com/Netflix/zuul
Filter Management
Advanced Usage of Gateway 
• Surgical debugging 
• Stress testing 
• Canary testing 
• Service migration 
• Load shedding 
• Active/Active traffic management
Migration to MicroService 
Achievement @Ctrip 
• System decoupled and domain ownership 
clarified 
• Business innovation speed accelerated 
• Overall system reliability improved 
• Decentralized architecture w/o SPOF 
• Develop, test, deploy and scale independently 
• Evolutionary architecture
What We Have Learned One 
• Smooth Migration 
– Give buffer to user for migration
What We Have Learned Two 
• Follow Architecture & Design Best Practice 
– Single responsibility & separation of concerns 
– Dependency inversion 
– Dependency isolation 
– Rate limiting & circuit breaker 
– Dynamic deployable & re-configurable 
• Top-Level Design 
– Fit service into infra, not fit infra into service
What We Have Learned Three 
• Conway’s Law 
– “Any organization that design a system(defined 
broadly) will produce a design whose structure is a 
copy of the organization’s communication 
structure” – Melvin Conway, 1968 
– “Those system then constrain the options for 
organizational change” – Dan North
Caveat 
• MicroService is not a Free Lunch 
– Significant operations overhead 
– Substantial DevOps skills required 
– Implicit interface 
– Duplication of effort 
– Distributed system complexity 
– Testability challenges 
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
Future – Soft Load Balancing
Future – Cross Data Centers
About Me 
• William Yang(杨波) 
• Dev Manager & Architect @Ctrip Middleware 
Team @Shanghai 
We are 
hiring!
谢谢

Weitere ähnliche Inhalte

Was ist angesagt?

Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.
Mikhail Panchenko
 

Was ist angesagt? (20)

About Microservices, Containers and their Underestimated Impact on Network Pe...
About Microservices, Containers and their Underestimated Impact on Network Pe...About Microservices, Containers and their Underestimated Impact on Network Pe...
About Microservices, Containers and their Underestimated Impact on Network Pe...
 
VMWare on VMWare - How VMware IT Implemented Micro-Segmentation and Deployed ...
VMWare on VMWare - How VMware IT Implemented Micro-Segmentation and Deployed ...VMWare on VMWare - How VMware IT Implemented Micro-Segmentation and Deployed ...
VMWare on VMWare - How VMware IT Implemented Micro-Segmentation and Deployed ...
 
Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.Building a cloud service on a cloud infrastructure. Also, cloud.
Building a cloud service on a cloud infrastructure. Also, cloud.
 
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red HatThe Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
 
The Reactive Principles: Design Principles For Cloud Native Applications
The Reactive Principles: Design Principles For Cloud Native ApplicationsThe Reactive Principles: Design Principles For Cloud Native Applications
The Reactive Principles: Design Principles For Cloud Native Applications
 
Why resilience - A primer at varying flight altitudes
Why resilience - A primer at varying flight altitudesWhy resilience - A primer at varying flight altitudes
Why resilience - A primer at varying flight altitudes
 
Running and Managing Your Network Just Got Easier
Running and Managing Your Network Just Got EasierRunning and Managing Your Network Just Got Easier
Running and Managing Your Network Just Got Easier
 
The Vision for the Future of Network Virtualization with VMware NSX (Q2 2016)
The Vision for the Future of Network Virtualization with VMware NSX (Q2 2016)The Vision for the Future of Network Virtualization with VMware NSX (Q2 2016)
The Vision for the Future of Network Virtualization with VMware NSX (Q2 2016)
 
An Introduction to Chaos Engineering
An Introduction to Chaos EngineeringAn Introduction to Chaos Engineering
An Introduction to Chaos Engineering
 
Designing Events-first Microservices
Designing Events-first MicroservicesDesigning Events-first Microservices
Designing Events-first Microservices
 
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
The Future of Services: Building Asynchronous, Resilient and Elastic SystemsThe Future of Services: Building Asynchronous, Resilient and Elastic Systems
The Future of Services: Building Asynchronous, Resilient and Elastic Systems
 
Containers and Why They Matter
Containers and Why They MatterContainers and Why They Matter
Containers and Why They Matter
 
20150311 NSX update 301
20150311 NSX update 30120150311 NSX update 301
20150311 NSX update 301
 
Infographic: Supercharge your Networking Career
Infographic: Supercharge your Networking CareerInfographic: Supercharge your Networking Career
Infographic: Supercharge your Networking Career
 
Chaos Engineering – why we should all practice breaking things on purpose by ...
Chaos Engineering – why we should all practice breaking things on purpose by ...Chaos Engineering – why we should all practice breaking things on purpose by ...
Chaos Engineering – why we should all practice breaking things on purpose by ...
 
CONFIGURATION MANAGEMENT IN THE CLOUD NATIVE ERA, SHAHAR MINTZ, EggPack
CONFIGURATION MANAGEMENT IN THE CLOUD NATIVE ERA, SHAHAR MINTZ, EggPackCONFIGURATION MANAGEMENT IN THE CLOUD NATIVE ERA, SHAHAR MINTZ, EggPack
CONFIGURATION MANAGEMENT IN THE CLOUD NATIVE ERA, SHAHAR MINTZ, EggPack
 
Beyond Network Virtualization
Beyond Network VirtualizationBeyond Network Virtualization
Beyond Network Virtualization
 
Microservices - when, why and how incontrodevops.it
Microservices  - when, why and how incontrodevops.itMicroservices  - when, why and how incontrodevops.it
Microservices - when, why and how incontrodevops.it
 
VMworld 2016 Recap
VMworld 2016 RecapVMworld 2016 Recap
VMworld 2016 Recap
 
Chaos engineering intro
Chaos engineering introChaos engineering intro
Chaos engineering intro
 

Andere mochten auch

淘宝前端架构(玉伯)[懒懒交流会#38]
淘宝前端架构(玉伯)[懒懒交流会#38]淘宝前端架构(玉伯)[懒懒交流会#38]
淘宝前端架构(玉伯)[懒懒交流会#38]
taobao.com
 

Andere mochten auch (16)

A Big, Fast and Persistent Queue
A Big, Fast and Persistent QueueA Big, Fast and Persistent Queue
A Big, Fast and Persistent Queue
 
一个前端的自我修养 Winter
一个前端的自我修养 Winter一个前端的自我修养 Winter
一个前端的自我修养 Winter
 
当当网Docker应用实践
当当网Docker应用实践当当网Docker应用实践
当当网Docker应用实践
 
3 a forum 2016 陆金所前端进化论 微服务之路(public)
3 a forum 2016 陆金所前端进化论 微服务之路(public)3 a forum 2016 陆金所前端进化论 微服务之路(public)
3 a forum 2016 陆金所前端进化论 微服务之路(public)
 
Evolving Goals: IT vs. Product Mindset
Evolving Goals: IT vs. Product MindsetEvolving Goals: IT vs. Product Mindset
Evolving Goals: IT vs. Product Mindset
 
How microservices are redefining modern application architecture
How microservices are redefining modern application architectureHow microservices are redefining modern application architecture
How microservices are redefining modern application architecture
 
What is OKR?
What is OKR?What is OKR?
What is OKR?
 
Resilience with Hystrix
Resilience with HystrixResilience with Hystrix
Resilience with Hystrix
 
Performance Management Tips
Performance Management Tips Performance Management Tips
Performance Management Tips
 
(OKR) Goal setting : Objectives Key Results
(OKR) Goal setting : Objectives Key Results(OKR) Goal setting : Objectives Key Results
(OKR) Goal setting : Objectives Key Results
 
淘宝前端架构(玉伯)[懒懒交流会#38]
淘宝前端架构(玉伯)[懒懒交流会#38]淘宝前端架构(玉伯)[懒懒交流会#38]
淘宝前端架构(玉伯)[懒懒交流会#38]
 
Agile2016: Stop Using Agile with Waterfall Goals: Goal Agility with OKR
Agile2016: Stop Using Agile with Waterfall Goals: Goal Agility with OKR Agile2016: Stop Using Agile with Waterfall Goals: Goal Agility with OKR
Agile2016: Stop Using Agile with Waterfall Goals: Goal Agility with OKR
 
Building an Agile Culture with OKR
Building an Agile Culture with OKRBuilding an Agile Culture with OKR
Building an Agile Culture with OKR
 
The Guide to Objectives and Key Results (OKRs)
The Guide to Objectives and Key Results (OKRs)The Guide to Objectives and Key Results (OKRs)
The Guide to Objectives and Key Results (OKRs)
 
Guide to OKR (Objectives & Key Results)
Guide to OKR (Objectives & Key Results)Guide to OKR (Objectives & Key Results)
Guide to OKR (Objectives & Key Results)
 
Power Your Business with OKRs
Power Your Business with OKRsPower Your Business with OKRs
Power Your Business with OKRs
 

Ähnlich wie MicroServices architecture @ Ctrip v1.1

AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig DicksonAWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
Amazon Web Services Korea
 

Ähnlich wie MicroServices architecture @ Ctrip v1.1 (20)

Concurrency at Scale: Evolution to Micro-Services
Concurrency at Scale:  Evolution to Micro-ServicesConcurrency at Scale:  Evolution to Micro-Services
Concurrency at Scale: Evolution to Micro-Services
 
building microservices
building microservicesbuilding microservices
building microservices
 
Microservice intro
Microservice introMicroservice intro
Microservice intro
 
Micro service session 1
Micro service   session 1Micro service   session 1
Micro service session 1
 
Alex Thissen (Xpirit) - Een verschuiving in architectuur: op weg naar microse...
Alex Thissen (Xpirit) - Een verschuiving in architectuur: op weg naar microse...Alex Thissen (Xpirit) - Een verschuiving in architectuur: op weg naar microse...
Alex Thissen (Xpirit) - Een verschuiving in architectuur: op weg naar microse...
 
From SOA to MSA
From SOA to MSAFrom SOA to MSA
From SOA to MSA
 
Continuous delivery by sergey seletsky
Continuous delivery by sergey seletskyContinuous delivery by sergey seletsky
Continuous delivery by sergey seletsky
 
Iot cloud service v2.0
Iot cloud service v2.0Iot cloud service v2.0
Iot cloud service v2.0
 
Microservices & Container Networking - OSN Days, Singapore
Microservices & Container Networking - OSN Days, SingaporeMicroservices & Container Networking - OSN Days, Singapore
Microservices & Container Networking - OSN Days, Singapore
 
The Overview of Microservices Architecture
The Overview of Microservices ArchitectureThe Overview of Microservices Architecture
The Overview of Microservices Architecture
 
An introduction to Microservices
An introduction to MicroservicesAn introduction to Microservices
An introduction to Microservices
 
Closer Look at Cloud Centric Architectures
Closer Look at Cloud Centric ArchitecturesCloser Look at Cloud Centric Architectures
Closer Look at Cloud Centric Architectures
 
Microservices Architecture
Microservices ArchitectureMicroservices Architecture
Microservices Architecture
 
DEVNET-1142 Decomposing Monolithic Applications to Microservices
DEVNET-1142	Decomposing Monolithic Applications to MicroservicesDEVNET-1142	Decomposing Monolithic Applications to Microservices
DEVNET-1142 Decomposing Monolithic Applications to Microservices
 
AWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWSAWS Summit Auckland - Smaller is Better - Microservices on AWS
AWS Summit Auckland - Smaller is Better - Microservices on AWS
 
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig DicksonAWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
AWS Innovate: Smaller IS Better – Exploiting Microservices on AWS, Craig Dickson
 
Do I Need A Service Mesh.pptx
Do I Need A Service Mesh.pptxDo I Need A Service Mesh.pptx
Do I Need A Service Mesh.pptx
 
170215 msa intro
170215 msa intro170215 msa intro
170215 msa intro
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
Building data-driven microservices
Building data-driven microservicesBuilding data-driven microservices
Building data-driven microservices
 

Kürzlich hochgeladen

75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
Asmae Rabhi
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
galaxypingy
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 

Kürzlich hochgeladen (20)

Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 

MicroServices architecture @ Ctrip v1.1

  • 1. MicroService Architecture @Ctrip William Yang(杨波) Dev Manager & Architect @Ctrip.com
  • 2. Problem Domain • System decoupling for deployability and scalability • Evolutionary architecture and adaptive organization • Mobile Backend Architecture
  • 3. Agenda • The curse of the monolith • Case study – decomposing Ctrip mobile backend into microservice • Microservice best practice • What we have learned
  • 4. Initial Ctrip Mobile Backend Architecture Monolithic Mobile Service SBU A SBU B SBU C SBU D SOA/ESB
  • 5. Pros & Cons • At the beginning … simple to develop, test, deploy and scale • Later … huge, complex, monolithic mobile service
  • 6. The Curse of the Monolith • Bloated codebase • Communication and coordination cost • Obstacle for frequent deployments • Little resilience to failure • Commitment to a single technology stack • Hindering innovation
  • 7. MicroService Architecture Style • Decomposing a single app as a suite of services • Communicating with lightweight mechanism • Built around business capabilities • Independently deployable • Minimum of centralized management • May be written in different programming languages and use different storages http://martinfowler.com/articles/microservices.html
  • 8. Who has Migrated to MicroService http://microservices.io/patterns/microservices.html
  • 9. New Mobile Backend Arch @Ctrip
  • 10. Key MicroService Infrastructure • Service – Service framework, gateway, registry • Monitoring – Logging, tracing, metrics • Deployment – TEST/UAT/PROD environments – CI/CD • Push common concerns to technical infrastructure
  • 13. MicroService Availability • Assume a monolithic service with 99.99% availability, what if you have ~30 microservices each with 99.99% availability?? • Combined effective availability == 2 HOURS of downtime per month == 99.7% uptime!!
  • 16. Cascading Failure at Peak Hour
  • 17. Basics of Service Fault Tolerance • Circuit Breaker(Fuse Blow) • Isolation • Rate Limiting • Fallback
  • 18. Hystrix Circuit Breaker http://github.com/netflix/hystrix
  • 21. Gateway Filtering Mechanism “pre” filters “routing” filter(s) “post” filters Origin Server “error” filters HTTP Request Http Request Http Response https://github.com/Netflix/zuul
  • 23. Advanced Usage of Gateway • Surgical debugging • Stress testing • Canary testing • Service migration • Load shedding • Active/Active traffic management
  • 24. Migration to MicroService Achievement @Ctrip • System decoupled and domain ownership clarified • Business innovation speed accelerated • Overall system reliability improved • Decentralized architecture w/o SPOF • Develop, test, deploy and scale independently • Evolutionary architecture
  • 25. What We Have Learned One • Smooth Migration – Give buffer to user for migration
  • 26. What We Have Learned Two • Follow Architecture & Design Best Practice – Single responsibility & separation of concerns – Dependency inversion – Dependency isolation – Rate limiting & circuit breaker – Dynamic deployable & re-configurable • Top-Level Design – Fit service into infra, not fit infra into service
  • 27. What We Have Learned Three • Conway’s Law – “Any organization that design a system(defined broadly) will produce a design whose structure is a copy of the organization’s communication structure” – Melvin Conway, 1968 – “Those system then constrain the options for organizational change” – Dan North
  • 28. Caveat • MicroService is not a Free Lunch – Significant operations overhead – Substantial DevOps skills required – Implicit interface – Duplication of effort – Distributed system complexity – Testability challenges http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
  • 29. Future – Soft Load Balancing
  • 30. Future – Cross Data Centers
  • 31. About Me • William Yang(杨波) • Dev Manager & Architect @Ctrip Middleware Team @Shanghai We are hiring!