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
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!!
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