Defining Microservices

31
Defining Microservices Matt McLarty DevOps: API Management and Application Development CA Technologies VP, API Academy Session DO3X70E @MattMcLartyBC #CAWorld

Transcript of Defining Microservices

Page 1: Defining Microservices

Defining Microservices

Matt McLarty

DevOps: API Management and Application Development

CA Technologies

VP, API Academy

Session DO3X70E

@MattMcLartyBC

#CAWorld

Page 2: Defining Microservices

5 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Agenda

MICROSERVICES – A BRIEF HISTORY

GOALS

PUTTING IT ALL TOGETHER

PRINCIPLES

MICROSERVICES – A DEFINITION

DEPENDENCIES & PITFALLS

1

2

3

4

5

6

Page 3: Defining Microservices

6 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Defining Microservices

Somebody does something new, then shares it

• Amazon, Netflix, Gilt, SoundCloud…

A pattern emerges, and so do evangelists

• Martin Fowler, Adrian Cockroft, Sam Newman…

The trend goes mainstream, sects emerge

• SOA revivalists, container devotees, DevOps purists…

A Study in IT Trends

Let’s take a step back…

Page 4: Defining Microservices

7 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Enterprise IT TimelinesOrganization, Architecture & SDLC

2012-20152008-112004-072000-031996-99

Organization IT city states CIO centralization Efficiency, stability and cost savings

Mobile and Shadow IT

Rise of the Chief Digital Officer

Architecture Web meets the Enterprise

Rise of SOA SOA Golden Age A New Paradigm APIs everywhere

Lifecycle Waterfall ITIL and CMM Rise of Agile Cloud and CI/CD Decentralization & DevOps

Page 5: Defining Microservices

8 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

CI/CDCloud

ComputingWeb APIs

DevOpsOpen Source

EverythingJavascript

Frameworks

GitHubContainers/

DockerMicroserviceArchitecture

Resulting Trends…

Page 6: Defining Microservices

9 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

• No more fear of changeCI/CD

• Instantaneous provisioningCloud Computing

• Self-serve integrationWeb APIs

• An empathetic, agile cultureDevOps

• Instant pluggable codeOpen Source Everything

• A way to create more developersJavascript Frameworks

• A way to connect all these developersGitHub

• Exact replication of code deploymentsContainers/Docker

• Optimal application style for DevOps…Microservice Architecture

What do these trends bring?

Page 7: Defining Microservices

10 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Defining Microservices

The architectural realization of DevOps?

SOA 2.0?

Single function container-based applications?

OR

By business value…

Take Two

Page 8: Defining Microservices

11 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservices Business Value – A Technologist’s View

Technology heterogeneity

Resilience ScalingEase of

deployment

Organizational alignment

ComposabilityOptimizing for replaceability

From “Building Microservices” by Sam Newman

Page 9: Defining Microservices

12 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservices Business Value – A VC’s View

Agility Efficiency

Resiliency Revenue

From “Innovate or Die: The Rise of Microservices” by Matt Miller

Page 10: Defining Microservices

13 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservices Business Value – A Combined View

Increased Revenue

Agility

Technology heterogeneity

Ease of deployment

Organizational alignment

Composability

Cost Savings

Efficiency

Resiliency ScalingOptimizing for replaceability

Page 11: Defining Microservices

14 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Business Value Stories

“We can scale our operation independently, maintain unparalleled system availability, and introduce new services quickly without the need for massive reconfiguration.”

•Werner Vogels, Amazon (2006) https://queue.acm.org/detail.cfm?id=1142065

“…the next generation [architecture] that we are building will give Netflix a strong foundation to meet the needs of our massive and growing scale, enabling us to delight our global audience.”

•Netflix (2015) http://techblog.netflix.com/2015/01/netflixs-viewing-data-how-we-know-where.html

“Lessens dependencies between teams - resulting in faster code to production.”

•Adrian Trenaman, Gilt (2015) http://www.infoq.com/news/2015/04/scaling-microservices-gilt

“With the new architecture framework, we were able to reduce our lead time for new features to something that…was much more acceptable for a company trying to play in the highly competitive music industry.”

•Phil Calçado, SoundCloud (2015) http://philcalcado.com/2015/09/08/how_we_ended_up_with_microservices.html

Page 12: Defining Microservices

15 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservices Principles

ModularityDomain

alignmentSystems thinking

Page 13: Defining Microservices

16 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Modularity

“Modularity … is to a technological economy what the division of labor is to

a manufacturing one.”

- W. Brian Arthur, The Nature of Technology

Page 14: Defining Microservices

17 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Modularity…

• APIs, containers and cloud

• Heroku’s 12 factors

• Encapsulation: “Smart endpoints and dumb pipes” (Fowler, Lewis)

In the technology

• Componentized infrastructure

• Evolvable architecture

• Granular ownership (Newman)

In the system

Page 15: Defining Microservices

18 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

But Modularity is not enough on its own…

Fine-grained services

Page 16: Defining Microservices

19 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Domains

“The heart of software is its ability to solve domain-related problems for its user.”

― Eric Evans, Domain-Driven Design: Tackling Complexity in the Heart of Software

Page 17: Defining Microservices

20 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Defining Domains

• “Bounded Contexts”Domain-Driven Design

• Separate models for Query and Command (state change)

Command Query Responsibility

Segregation (CQRS)

• Client-focused and iterative• http://www.christenseninstitute.org/key-concepts/jobs-to-be-done/

“Jobs-to-be-done”

Page 18: Defining Microservices

21 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservice Boundaries

The consequence of domain definition, or the driver?

Defining service boundaries is an art, not a science

Optimal service boundaries will be fluid over time

So… Design for evolvability!

Page 19: Defining Microservices

22 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Organizational Alignment with DomainsConway’s Law - http://www.melconway.com/Home/Conways_Law.html

Any organization that designs a system (defined broadly) will produce a design

whose structure is a copy of the organization's communication structure.

- Mel Conway

Page 20: Defining Microservices

23 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Organizational Alignment with DomainsIllustration from Fowler & Lewis - http://martinfowler.com/articles/microservices.html

vs.

Page 21: Defining Microservices

24 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

But Domains are part of a System…

Image retrieved from https://upload.wikimedia.org/wikipedia/commons/d/d2/Internet_map_1024.jpg

Page 22: Defining Microservices

25 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Systems Thinking

A complex system that works is invariably found to have evolved from a simple system

that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a

working simple system.

- John Gall, Systemantics: How Systems Really Work and How They Fail

Page 23: Defining Microservices

26 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Systems, not Applications

The “Monolith First” movement

Complex vs. Complicated– “A car key is simple. A car is complicated. A car in traffic is complex.” –

From Michael Lewis’ Flash Boys

Monoliths are complex systems disguised as applications

Understand that you are not “building an application”…

…You are likely “changing a system”

Page 24: Defining Microservices

27 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Respecting the System

The Butterfly Effect and the echo chamber

Focus on the interdependencies between components and domains– Interfaces, APIs

Design for constant change

Page 25: Defining Microservices

28 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

System Control

The system cannot be controlled…– “REST emphasizes evolvability to sustain an

uncontrollable system” – Roy Fielding

…But it can be monitored and influenced– Think of public policy influencing financial markets

Focus on shortening the time between data collection, analysis and resulting action

Page 26: Defining Microservices

29 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Defining Microservices

An architectural style for building an application as a network-based system of modular services

organized by business domains in order to improve the application’s evolvability,

deployability, composability, scalability, resiliency and replaceability

Take Three

Page 27: Defining Microservices

30 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Microservices Dependencies

Cloud infrastructure

Continuous delivery

DevOps culture

System management

APIs Containers?

Adapted from http://martinfowler.com/bliki/MicroservicePrerequisites.html

Page 28: Defining Microservices

31 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Potential Pitfalls with Microservices

Technological myopia

Ignoring the pre-requisites

Ignoring service boundaries

Overlooking the system

Trying to control the system

Boiling the ocean

Page 29: Defining Microservices

32 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Putting it all together

•The culmination of the Agile/API/Decentralization movementUnderstand where Microservices

fit in the evolution of IT

• Increase agility and efficiency to drive revenue and save costsStay focused on business goals

•Pre-reqs like CI/CD, DevOps and Cloud have standalone value

•Modularity is not enoughKnow where the benefits are

coming from

•Defining business domains and service boundaries

•Designing, managing and evolving the systemDon’t ignore the hard problems

Page 30: Defining Microservices

33 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Sources

Sam Newman, “Building Microservices” - http://shop.oreilly.com/product/0636920033158.do

“The Business Behind Microservices”, Daniel Bryant - https://www.opencredo.com/2015/09/24/the-

business-behind-microservices-webinar-replay/

Wall Street Journal Blog on Microservices, Matt Miller - http://blogs.wsj.com/cio/2015/10/05/innovate-or-

die-the-rise-of-microservices/

Fowler and Lewis’ blog post - http://martinfowler.com/articles/microservices.html

“Seven Microservices Anti-patterns”, Vijay Alagarasan - http://www.infoq.com/articles/seven-uservices-

antipatterns

Learning CTO blog post - http://thelearningcto.com/2015/04/24/the-hidden-costs-of-paas-microservice-

engineering-innovation/

“REST in AEM”, Roy Fielding - http://www.slideshare.net/AEMHub2014/rest-in-aem-by-roy-fielding

Page 31: Defining Microservices

34 © 2015 CA. ALL RIGHTS RESERVED.@CAWORLD #CAWORLD

Q & A