microservices: new frontiers -...

46
Microservices: New Frontiers September 25, 2017 Matt McLarty, VP, API Academy, CA Technologies, @mattmclartybc

Upload: buidat

Post on 22-Jun-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Microservices:New Frontiers

September 25, 2017

Matt McLarty, VP, API Academy, CA Technologies, @mattmclartybc

Page 2: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Microservices:we’ve come a long way already

Page 3: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

2014: Martin Fowler and James Lewis

http://martinfowler.com/articles/microservices.html

Page 4: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

2015: Sam Newman

“Getting integration right is the single most

important aspect of the technology associated

with microservices in my opinion. Do it well,

and your microservices retain their autonomy,

allowing you to change and release them

independent of the whole. Get it wrong, and

disaster awaits.”

- Sam Newman, Building Microserviceshttp://shop.oreilly.com/product/0636920033158.do

Page 5: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

2016: Microservice Architecture

“A microservice is an independently

deployable component of bounded scope that

supports interoperability through message-

based communication.

Microservice architecture is a style of

engineering highly-automated, evolvable

software systems made up of capability-aligned

microservices.”

http://shop.oreilly.com/product/0636920050308.do

Page 6: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

2016: Susan Fowler

The Four Layers of Microservice Architecturehttp://shop.oreilly.com/product/0636920053675.do

Page 7: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Forces driving microservices

Microservice Architecture

Decentralized Organizations

Agile Methodologies

DevOps Culture

Cloud Native Technologies

API-based Integration

Page 8: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

The common thread:complex software ecosystems

Page 9: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Ecosystems, not systems

“The promise is a diverse and dynamic

landscape of useful and innovative

products.”

Erik Wilde

“Don’t Let Your Microservices Garden Overgrow”

Page 10: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Many orgs have more than one monolith…

Page 11: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

How can you deal with complexity?

Page 12: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Differentiate the Complexity

Page 13: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Essential vs. Accidental Complexity

Essential Complexity

• The complexity of the software’s functional scope and the problems it solves (e.g. correlating and analyzing large amounts of data in real time)

Accidental Complexity

• The complexity of the software’s implementation details (e.g. the languages, processes and messages used to do the work)

Page 14: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

The Truth About Software Complexity

“Many of the classical problems of

developing software products derived

from this essential complexity and its

nonlinear increase with size.”

Fred Brooks

“No Silver Bullet—Essence and Accident in

Software Engineering”

Page 15: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Differentiating Complexity in Microservices

Essential Complexity in Microservices

• In a microservice architecture, the topology of the implemented system closely resembles the model of the system’s “essence”

Accidental Complexity in Microservices

• In a microservice architecture, accidental complexity can be minimized through automation and distribution

Page 16: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Modularize the system

• Herbert Simon, The

Architecture of Complexity,

1962

• Edsger Dijkstra, Structure of

the “THE”-multiprogramming

language, 1968

• David Parnas, On the

Criteria To Be Used in

Decomposing Systems into

Modules, 1972

Page 17: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Modularize the system

“Modularity … is to a technological

economy what the division of labor

is to a manufacturing one.”

W. Brian Arthur

The Nature of Technology

Page 18: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Visualize the system

“Different views of the design can

be used to manage complexity and

highlight different aspects of the

solution.”

Simon Brown

“The Art of Visualizing Software”

Page 19: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Visualize the system

“In distributed systems, or in any

mature, complex application of

scale built by good engineers … the

majority of your questions trend

towards the unknown-unknown”

Charity Majors

“Observability: What's in a Name?”

Page 20: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Focus on component interactions

“REST emphasizes evolvability to

sustain an uncontrollable system.”

Roy Fielding

“REST in AEM”

Page 21: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Standardize selectively

“Standardize via network protocols

and data contracts, just like the

internet.”

Ben Christensen

“Don’t Build a Distributed Monolith”

Page 22: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Remember the human element

“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

“How Do Committees Invent?”

Page 23: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

How can you deal with complexity in a practical way

using microservice architecture?

Page 24: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Common Language for Microservice Systems?

Kubernetes Cloud Foundry

From https://x-team.com/blog/introduction-kubernetes-architecture/ and https://docs.cloudfoundry.org/concepts/architecture/

Page 25: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Common Language for Microservice Systems

Term Definition

Service (AKA Microservice) A logical application component that provides functionality via an interface.

Service Domain A defined set of services that make up the logical microservice system for a given scope (e.g. company,

organizational unit, bounded context, application).

Service Cohort A group of services services that can be deployed independently, but rely on each other to complete user

tasks. Instances of services within a service cohort are often deployed within the same service node.

Kubernetes Pods and Mesosphere Application Groups are platform-specific examples of service cohorts.

Service Instance A runtime instance of the service with a network addressable interface. Note that a service instance can

be made up of multiple containers.

Service Network The collective network through which services in the service domain communicate with one another and

with components outside the service domain. The service network can span multiple service platforms.

Service Node A single infrastructure node for hosting services. Docker hosts and AWS EC2 instances are platform-

specific examples of service nodes.

Service Zone A subsection of the service network. AWS availability zones and Kubernetes clusters are platform-

specific example of service zones.

Page 26: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Domain – Logical View

Service a

Service b Service c Service d

Service e

Service f

Service h

Service i

Service k

Service j

Service g

Service l

Service Domain

Service Cohort A

Service Cohort B

Service Cohort C

Service Cohort D

Page 27: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Network – Physical View

Service a –Instance 1

Service b –Instance 2

Service c –Instance 2

Service d –Instance 2

Service e –Instance 1

Service f –Instance 1

Service h –Instance 1

Service i –Instance 1

Service k –Instance 1

Service j –Instance 1

Service g –Instance 1

Service l –Instance 1

Service Network

Service Zone 1

Service b –Instance 2

Service c –Instance 2

Service d –Instance 2

Service a –Instance 1

Service Node 1-1

Service Node 1-2

Service Zone 2

Service Node 2-1

Service Node 2-2

Service e –Instance 2

Service f –Instance 2

Service h –Instance 2

Service i –Instance 2

Service k –Instance 2

Service j –Instance 2

Service g –Instance 2

Service l –Instance 2

Service Zone 3

Service Node 3-1

Service Node 3-2

Page 28: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

DDD for Modeling Service Boundaries

• Effectively modeling essential complexity reduces

the need for coordination

• Eric Evans’ Domain-Driven Design provides a

framework for defining and modeling the essential

capabilities of complex software systems

Image credit: http://martinfowler.com/bliki/BoundedContext.html

Page 29: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Sample Microservices Context Map

More here: http://www.apiacademy.co/designing-a-system-of-microservices/

Subdomain SubdomainSubdomain

Subdomain

Subdomain

Subdomain

Bounded Context

Bounded Context

Bounded Context

Bounded Context

Bounded Context

Bounded Context

Bounded Context

Bounded Context

Bounded

Context

Bounded

Context

Service

Service

Service

Service

Service

Service

ServiceService

Service

ServiceService

Consumer

Service

Consumer

Service

Consumer

Service

AC

LA

CL

AC

L

Interaction

Interaction

Interaction

Interaction Interaction

Interaction

Page 30: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Multi-Cloud Access Control Model

Network-based controls

• TLS/SSL, ACL’s

Trust-based controls

• PKI

Token-based controls

• OAuth, JWT, OpenID Connect

Platform-based controls

• Kubernetes, Cloud Foundry, AWS

Page 31: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Microservice Interaction Patterns

Query Only

Request-Response

CQRS/Event-sourced

Reactive

Page 32: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Microservices Technological Capabilities

Page 33: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Incentive-based Governance

Selective Standards

Abundant Guidelines

Tools and Toolmaking

Cross-Team Collaboration

Empowered Dev Teams

Centralized Supports

Page 34: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

APIs vs. Microservices

API• An application interface

exposed on a network

• Many styles– RPC, CRUD, REST

• Many protocols– HTTP, Kafka, gRPC

• Many data formats– JSON, XML, protobuf

• Many implementations– standalone microservice, monolithic

application, API gateway, ESB

Microservice• Independently deployable

application component

• Often self-contained– Interface, logic, and data

• Exposes functionality to other

services and external clients via

APIs

Page 35: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

APIs for Microservices

APIs describe the functional capabilities of the system

• They allow architects to view and model the system without diving into the weeds

• They facilitate conversation between business and technology people

APIs offer a transition path to microservices

• Monolithic application services can be offered through APIs as a stepping stone

• This insulates service consumers from changes on the back end

APIs provide a normalized access point for system functions

• They provide interoperability between components

• Single point in the system to address security, composition, monitoring, and SLAs

Page 36: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Microservice Design Canvas

Consumer Tasks Dependencies

Qualities

Interface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsConsumer …

• Task list…

Consumer …

• Task list…

.

.

.

Service …

• Task list…

Service …

• Task list…

.

.

.

Service Name: Description:

Page 37: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Dependencies

Qualities

Interface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsService …

• Task list…

Service …

• Task list…

.

.

.

Consumer Tasks

Consumer …

• Task list…

Consumer …

• Task list…

.

.

.

Enumerating the consumers of the service along with the

tasks they need to perform helps to crystallize the purpose of

the service and provides the material inputs needed to design

the interface.

Page 38: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Consumer Tasks Dependencies

Qualities DataLogic/Rules

Consumer …

• Task list…

Consumer …

• Task list…

.

.

.

Service …

• Task list…

Service …

• Task list…

.

.

.

Interface

Queries Commands Event

Subscriptions

Event

Publications

Consumer tasks can be broken down into interactions with the

service interface. Classifying interactions according to

patterns—queries, commands, events—will help shape the

underlying service implementation

Page 39: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Consumer Tasks DependenciesInterface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsConsumer …

• Task list…

Consumer …

• Task list…

.

.

.

Service …

• Task list…

Service …

• Task list…

.

.

.

Qualities

In addition to the tasks and interactions for the service—what

it does—we must also consider the non-functional aspects of

the service—what it is. Identifying qualities such as availability

and performance levels, extensibility approaches, and

security expectations help further consumers’ understanding

of the service and also influence its implementation.

Page 40: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Consumer Tasks Dependencies

Qualities

Interface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsConsumer …

• Task list…

Consumer …

• Task list…

.

.

.

Service …

• Task list…

Service …

• Task list…

.

.

.Taken together, the consumer

tasks, interface and qualities define

the “surface” of the service

Page 41: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Consumer Tasks Dependencies

Qualities

Interface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsConsumer …

• Task list…

Consumer …

• Task list…

.

.

.

Service …

• Task list…

Service …

• Task list…

.

.

.

The “Logic/Rules” and

“Data” boxes provide a

place for service

designers to document

key considerations in

these areas. Resist the

temptation to go too deep

at this stage.

Page 42: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Service Name: Description:

Microservice Design Canvas

Consumer Tasks

Qualities

Interface

DataLogic/Rules

Queries Commands Event

Subscriptions

Event

PublicationsConsumer …

• Task list…

Consumer …

• Task list…

.

.

.

Dependencies

Service …

• Task list…

Service …

• Task list…

.

.

.

Finally, service dependencies are listed in

order to call out what tasks the service

requires. For task-heavy microservices

featuring a fair amount of business logic, it is

natural to require interactions with more

data-oriented services. However, in the spirit

of microservice architecture, the goal is to

minimize these dependencies.

Page 43: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Sample Microservice Design Canvas

Consumer Tasks Dependencies

Qualities• Mostly read only, except

for transaction removal

• Medium volume service ,

not mission critical

• Direct customer and

delegated authentication

• Not transactional

Interface

Data• Aggregated transaction

store

Logic/Rules• Populate aggregated

transaction store through

event listening (event

sourcing)

• Filter or adjust data query

based on input parameters

• Offer idempotent

transaction removal

command

Queries• Query customer

transactions

• Get transaction

details

Commands

• Remove

transaction

Event

Subscriptions• Add transaction

• Add transaction set

Event

PublicationsProduct-specific

Transaction Service

• Query transactions

Banking Customer

using Online Banking

Web or Mobile App

• Search transactions

• Get transaction

details

Banking CSR using

Branch Banking or

Call Center App

• Search transactions

• Get transaction

details

Service Name: Transaction Search Service Description: The Transaction Search Service allows consumers to find specific

transactions that fit a set of specified criteria. This criteria can range from date/time, to

spending category, to amounts, and more.

More here: http://www.apiacademy.co/the-microservice-design-canvas/

Page 44: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

API World Microservices Conference

MONDAY – Workshop Room 1

12:00 – 12:50 PM

New Frontiers for Microservices

Matt McLarty, API Academy

1:00 – 1:50 PM

The Hardest Part About

Microservices – Your Data

Christian Posta, RedHat

2:00 – 2:50 PM

Master of the Domain – API Access

Control in a Microservice Architecture

Rob Wilson, CA Technologies

Alan Marion, CIBC

3:00 – 3:25 PM

REST vs. Reactive – Interaction

patterns in microservice architecture

Mark Makary, Logic Keepers

TUESDAY – Main Stage

9:00 – 9:25

Monolith Strikes Back – Forces

Challenging a Transition to Microservices

Snezana Sahter, eBay

9:25 – 9:50 AM

Lifecycles – APIs and Microservices

Pete Clare, Vanick Digital

10:00 – 10:50 AM

PANEL: Microservices in Practice

Moderated by Lou Powell, Vanick

Jen Leech, Truss

Bill Monkman, Hootsuite

Bhanu Vegi, Beachbody

11:00 – 11:50 AM

Implementing Microservices at Capital One

Mark Donovan, Capital One

Irakli Nadareishvili, Capital One

MONDAY – Workshop Room 1

3:25 – 3:50 PM

Overcoming Obstacles to Success with

Microservices

Eric Roch, Perficient

4:00 – 4:50 PM

PANEL: The Evolution of Microservices

Protocols

Moderated by Matt McLarty

Fran Mendez, Hitch

Ryan Blain, Arvata

Mike Sample, Hootsuite

Varun Talwar, Google

5:00 – 5:50 PM

Low Code Microservices – Accelerating

Ideas to Implementation

Renu Motwani, CA Technologies

Geoff Duck, CA Technologies

Page 45: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Thank You!

Page 46: Microservices: New Frontiers - Schedschd.ws/hosted_files/apiworld2017/70/API-World-2017-New-Frontiers...Microservices: New Frontiers September ... 2014: Martin Fowler and ... Service

Vice President, API Academy, CA Technologies

[email protected]

Matt McLarty

@mattmclartybc

www.slideshare.net/MattMcLarty

linkedin.com/in/mattmclartybc

apiacademy.co