Slide 1

Slide 1 text

Services THE REAL VALUE OF MICROSERVICES Simon Martinelli, 72 Services LLC @simas_ch

Slide 2

Slide 2 text

ABOUT ME @simas_ch 2 2000 1995 Java COBOL 2009 2007 2012 2011 JSR-352 Batch 2013 JSR-354 Money /Currency

Slide 3

Slide 3 text

1972 The effectiveness of a “modularization” is dependent upon the criteria used in dividing the system into modules. On the criteria to be used in decomposing systems into modules - David L. Parnas Published in Communications of the ACM Volume 15 Issue 12, Dec. 1972 3

Slide 4

Slide 4 text

IT’S ALL ABOUT MODULARITY Module A self-contained component of a system, often interchangeable, which has a well-defined interface to the other components. Source: https://en.wiktionary.org/wiki/module 4

Slide 5

Slide 5 text

DOES THE SIZE MATTER? • The term MICRO is misleading • Scope matters • Bounded Contexts • Design for Maintenance • 3 to 10 developers per Microservice during project development • But how many developers will maintain the system? 5

Slide 6

Slide 6 text

WHAT ABOUT SERVICES? • Service-Oriented Architecture (SOA) is an architectural style that supports service-orientation • Service-orientation is a way of thinking in terms of services and service-based development and the outcomes of services • Service • Is a logical representation of a repeatable business activity that has a specified outcome (e.g., check customer credit, provide weather data) • Is self-contained • May be composed of other services • Is a black box to consumers of the service 6 Source: http://www.opengroup.org/soa/source-book/soa/p1.htm

Slide 7

Slide 7 text

ARE THEY REALLY THE SAME? 7

Slide 8

Slide 8 text

MODULARITY AND DISTRIBUTION 8 Distribution Modularity Modular monolith Monolithic big ball of mud Distributed big ball of mud Microservices

Slide 9

Slide 9 text

DISTRIBUTED BIG BALL OF MUD If you can't build a modular monolith, what makes you think microservices are the answer? - Simon Brown 9 Customer Order Catalog

Slide 10

Slide 10 text

BEWARE OF THE N+1 SELECT PROBLEM • Use Case: Select orders of customers • 1 request to get all customers • n requests to get customers orders 10 Customer Order Client 1 1 … n

Slide 11

Slide 11 text

DISTRUBUTION AND COMMUNICATION First Law of Distributed Object Design: Don't distribute your objects - Martin Fowler 11 Synchronous Asynchronous Event based

Slide 12

Slide 12 text

SUBSYSTEMS (AKA GARTNERS MINISERVICES) 12 Backend A Database A Database B Backend D Database D Frontend A Frontend B Frontend C Backend B Backend C Self-contained System Monolithic frontend Integration Database

Slide 13

Slide 13 text

HOW TO BREAK THE MONOLITH? A Real World Example 13

Slide 14

Slide 14 text

SYSTEM ISSUES • Cyclic dependencies • No component structure • Meaningless names 14

Slide 15

Slide 15 text

3 STEP REFACTORING • Step 1: Define target architecture • Define bounded contexts • Introduce pattern language • Separate infrastructure code from business code • Step 2: Move existing code to newly defined subsystems • Step 3 (optional): Distribute the subsystems 15

Slide 16

Slide 16 text

DEFINE BOUNDED CONTEXTS 16 Monitoring Analytics Testing Device Alarm Update Device KPI Profile Job Device Measure- ment

Slide 17

Slide 17 text

TARGET SYSTEMS ARCHITECTURE 17 Local Server Device(s) Monitor Message Bridge Remote Server Monitor Analytics Testing Message Broker Message Broker

Slide 18

Slide 18 text

MIGRATION SCENARIO (AKA STRANGLER PATTERN) 18 Backend Database Frontend Monolith Backend Database Frontend Step 1 Database Frontend Step 2..n Backend 1 Database 1 Backend Frontend 1 Backend n Database n Backend 1 Database 1 Subsystems Frontend n https://en.wikipedia.org/wiki/Strangler_fig

Slide 19

Slide 19 text

DECOUPLING THROUGH MESSAGING • Messaging enables modularity • Messaging enforces independence • Events not Request/Response 19 Monitor Analytics Testing Message Broker Device(s)

Slide 20

Slide 20 text

THE REAL VALUES • A microservices architecture leads to modularity • Developers are forced to follow the structure • It’s easier to replace a subsystem instead of the whole system in the future 20

Slide 21

Slide 21 text

Thank You 72 Services LLC Moosentli 7, 3235 Erlach Switzerland +41 32 544 8888 info@72.services 72.services