$30 off During Our Annual Pro Sale. View Details »

Breaking down problems

Breaking down problems

When starting with microservice architectures a common question people ask is "how big should a service be?” While this is sometimes useful when considering the complexity of a system, it doesn’t capture the variety of use cases or problems systems may be solving — a service that selects emoji for push notifications will probably be simpler than one of the core services in a payment processor?

In this talk we’ll look at how Monzo approach problem solving, taking business ideas and breaking them down into small, simple, services which together build a system that is more than the sum of its parts.

mattheath

May 29, 2019
Tweet

More Decks by mattheath

Other Decks in Programming

Transcript

  1. Breaking down
    problems
    Building systems of systems
    with microservices at Monzo

    @mattheath

    View Slide

  2. Hi, I’m Matt

    View Slide

  3. @mattheath

    View Slide

  4. View Slide

  5. View Slide

  6. 16:02
    Wednesday 29 May

    View Slide

  7. Nov
    2015
    May
    2019
    Fastest growing UK Bank

    2m customers
    40k a week

    View Slide

  8. View Slide

  9. View Slide

  10. View Slide

  11. View Slide

  12. LICENCE WITH
    RESTRICTIONS
    WE ARE
    HERE
    A UK banking licence is authorised by the PRA and
    regulated by the PRA and FCA1, allowing deposit-
    taking and balance sheet lending. Once granted,
    it allows firms to passport across Europe, accessing
    This is followed by a “mobilisation” phase during
    which final capital is raised and IT systems are
    completed, before launching to the public.
    We received a UK banking licence in August 2016!
    FEB
    2015
    JAN
    2016
    JAN
    2017
    MAR FEB FEB
    APR MAR MAR APR MAY JUN JUL
    MAY APR
    JUN MAY
    JUL JUN
    AUG JUL
    SEP AUG
    NOV SEP
    DEC NOV DEC
    PRE APPLICATION APPLICATION MOBILISATION LAUNCH
    LICENCE WITH
    RESTRICTIONS
    50K MAX
    DEPOSIT
    WE ARE
    HERE
    A UK banking licence is authorised by the PRA and
    regulated by the PRA and FCA1, allowing deposit-
    taking and balance sheet lending. Once granted,
    it allows firms to passport across Europe, accessing
    This is followed by a “mobilisation” phase during
    which final capital is raised and IT systems are
    completed, before launching to the public.
    We received a UK banking licence in August 2016!
    JAN
    2016
    JAN
    2017
    MAR FEB FEB
    APR MAR MAR APR MAY JUN JUL
    MAY APR
    JUN MAY
    JUL JUN
    AUG JUL
    SEP AUG
    NOV SEP
    DEC NOV DEC
    E APPLICATION APPLICATION MOBILISATION LAUNCH
    LICENCE WITH
    RESTRICTIONS
    WE ARE
    HERE
    AUG

    2016
    JAN

    2016
    Feb

    2015
    APR

    2017
    A UK banking licence is authorised by the PRA and
    regulated by the PRA and FCA1, allowing deposit-
    taking and balance sheet lending. Once granted,
    it allows firms to passport across Europe, accessing
    This is followed by a “mobilisation” phase during
    which final capital is raised and IT systems are
    completed, before launching to the public.
    We received a UK banking licence in August 2016!
    FEB
    2015
    JAN
    2016
    JAN
    2017
    MAR FEB FEB
    APR MAR MAR APR
    MAY APR
    JUN MAY
    JUL JUN
    AUG JUL
    SEP AUG
    NOV SEP
    DEC NOV DEC
    PRE APPLICATION APPLICATION MOBILISATION
    LICENCE WITH
    RESTRICTIONS
    WE ARE
    HERE

    View Slide

  13. Henrik Kniberg

    View Slide

  14. Henrik Kniberg

    View Slide

  15. James
    Leah
    Matt

    View Slide

  16. James
    Leah
    Matt

    View Slide

  17. James
    Leah
    Matt

    View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. View Slide




  22. X
    X
    X

    View Slide

  23. View Slide

  24. View Slide

  25. View Slide


  26. ☕☕

    View Slide

  27. ☕☕

    View Slide

  28. Payment API Ledger

    View Slide

  29. Payment API Ledger
    Database

    View Slide

  30. Transactions
    Payment API
    Ledger

    View Slide

  31. Transactions
    Payment API
    Ledger
    Accounts

    View Slide

  32. Payment API Transactions
    Ledger
    Accounts
    Cassandra
    Database

    View Slide

  33. Payment API Transactions
    Ledger
    Accounts
    Cassandra
    Database
    ?
    ?
    ?
    ?
    ?
    ?
    ?
    ?
    ?

    View Slide

  34. Henrik Kniberg

    View Slide

  35. View Slide

  36. View Slide

  37. View Slide

  38. View Slide

  39. View Slide

  40. Payment API Transactions
    Ledger
    Accounts
    Cassandra
    Database

    View Slide

  41. Card API
    Payment API Transactions
    Ledger
    Accounts
    Cassandra
    Database

    View Slide

  42. IT’S REAL!

    View Slide

  43. View Slide

  44. View Slide

  45. View Slide

  46. View Slide

  47. View Slide

  48. View Slide

  49. View Slide

  50. Feb
    2015
    May
    2019
    monzo services

    View Slide

  51. 1136
    Feb
    2015
    May
    2019
    monzo services

    View Slide

  52. Why do we break
    down problems?

    View Slide

  53. View Slide

  54. View Slide

  55. View Slide

  56. Why do we break down problems?
    Manage risk
    , Scale organisations
    Use the best tools for the job

    View Slide

  57. Why do we break down problems?
    Manage risk
    , Scale organisations
    Use the best tools for the job

    View Slide

  58. Managing risk
    ⚠ Are we building the right thing?
    ⚠ Will we hit deadlines?

    View Slide

  59. Henrik Kniberg

    View Slide

  60. Guiding Principle:

    Ship it, and iterate.

    View Slide

  61. Guiding Principle:

    Make changes small,
    make them often

    View Slide

  62. Why do we break down problems?
    Manage risk
    Use the best tools for the job
    , Scale organisations

    View Slide

  63. Why do we break down problems?
    Manage risk
    Use the best tools for the job
    , Scale organisations

    View Slide

  64. How do we break
    down problems?

    View Slide

  65. Dividing features up

    View Slide

  66. Henrik Kniberg

    View Slide

  67. Split by domain

    View Slide

  68. Split by domain
    users
    transactions
    faster payments
    card payments
    cards
    accounts
    addresses
    profiles
    feature flags
    points
    pots
    direct debits

    View Slide

  69. Split by responsibility

    View Slide

  70. Split by responsibility
    card
    management
    customer

    signup
    clearing

    processing
    reconciliation
    pots
    accounts
    authentication
    authorisation
    bank

    statements
    message
    signing

    View Slide

  71. Guiding Principle:

    Do one thing, do it well.

    View Slide

  72. Examples:

    Building APIs

    View Slide

  73. View Slide

  74. View Slide

  75. API

    View Slide

  76. API

    View Slide

  77. API
    Service
    API
    Service
    API
    Service
    API
    Service
    API
    Service
    API
    Service
    API
    Service
    API
    Service
    Edge Gateway

    View Slide

  78. View Slide

  79. Accounts Cards Pots Feed Payments …
    Edge Gateway

    View Slide

  80. Edge Gateway
    Accounts Cards Pots Payments …
    New

    Exciting

    API!!

    Feed

    View Slide

  81. Cards Pots Payments …
    Accounts
    New

    Exciting

    API!!





    Feed
    Edge Gateway

    View Slide

  82. Cards Pots Payments …
    Accounts
    New

    Exciting

    API!!






    Feed
    Edge Gateway

    View Slide

  83. Edge Gateway
    Accounts Cards Pots Payments …
    New

    Exciting

    API!!


    Feed

    View Slide

  84. Isolate failure
    Make changes small, make them often
    Ship it, and iterate
    , Scale teams and organisations

    View Slide

  85. Single responsibility

    View Slide

  86. Load Balancer
    Edge Gateway

    View Slide

  87. Load Balancer
    Edge Gateway
    API
    Service

    View Slide

  88. Service
    A
    Load Balancer
    Edge Gateway
    API
    Service

    View Slide

  89. Service
    A
    Service
    B
    Load Balancer
    Edge Gateway
    API
    Service

    View Slide

  90. Service
    A
    Service
    B
    Load Balancer
    Edge Gateway
    API
    Service
    Responsible for external interface
    Responsible for domain logic
    Responsible for routing

    View Slide

  91. Manage complexity

    View Slide

  92. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API

    View Slide

  93. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service

    View Slide

  94. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service
    IBAN

    Service

    View Slide

  95. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service
    IBAN

    Service
    Account service responsibility
    remains unchanged, even as overall
    system complexity increases

    View Slide

  96. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service
    IBAN

    Service
    Additional, simple, services
    solve related but separate problems

    View Slide

  97. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service
    IBAN

    Service

    View Slide

  98. Account

    Service
    Load Balancer
    Edge Gateway
    Account

    API
    Account

    Number

    Service
    IBAN

    Service

    Euro

    Payment

    Services
    5

    View Slide

  99. Account

    Service
    Account

    Number

    Service
    IBAN

    Service

    Euro

    Payment

    Services
    5
    Decoupling more specialised
    behaviour keeps services simple
    6

    View Slide

  100. Account

    Service
    Account

    Number

    Service
    IBAN

    Service

    Euro

    Payment

    Services
    5
    Faster

    Payment

    Services
    6

    View Slide

  101. Account

    Service
    Account

    Number

    Service
    IBAN

    Service

    Euro

    Payment

    Services
    5
    Faster

    Payment

    Services
    6

    View Slide

  102. Account

    Service
    Account

    Number

    Service
    IBAN

    Service

    Euro

    Payment

    Services
    5
    Faster

    Payment

    Services
    6

    Isolating failure along domain
    boundaries improves availability

    View Slide

  103. Managing Complexity

    View Slide

  104. Guiding Principle:

    Simplicity

    View Slide

  105. https://xkcd.com/927/

    View Slide

  106. Feb
    2015
    May
    2019
    monzo services

    View Slide

  107. Feb
    2015
    May
    2019
    monzo services
    The Refactathon
    https://monzo.com/blog/2018/12/04/refactoring-old-code/

    View Slide

  108. 8 Identify areas of complexity and debt
    ⏱ Make time to improve these
    Teams move faster as a result

    View Slide

  109. Guiding Principle:

    Standardisation

    View Slide

  110. Build on abstractions

    View Slide

  111. instance instance instance instance instance instance

    View Slide

  112. instance instance instance instance instance instance
    Kubernetes

    View Slide

  113. kubernetes

    View Slide

  114. kubernetes
    service service service service service service
    service
    service
    service service service
    service
    service

    View Slide

  115. kubernetes
    service Prometheus service service Kafka envoy
    Kafka
    service
    service Elasticsearch calico
    API
    service

    View Slide

  116. Service
    Service
    Reliable inter-service

    communication offloaded to
    Envoy, simplifying services

    View Slide

  117. API
    Service
    Service
    A
    Service
    B
    Load Balancer
    Edge Gateway
    Service
    D
    Service
    D
    Service
    C
    Event based communication
    decouples services, lets us build
    reliable pipelines, and helps
    isolate failure

    View Slide

  118. Simple systems are more reliable
    Small systems are faster to iterate
    Failure can be isolated and constrained

    View Slide

  119. Standardisation makes everything easier
    Onboard new people quickly
    People feel empowered and productive
    Build reliable systems, faster.

    View Slide

  120. View Slide

  121. monzo.com/careers

    View Slide