to microservices and beyond

Post on 10-Aug-2015

24 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

© Copyright 2014 Pivotal. All rights reserved.© Copyright 2014 Pivotal. All rights reserved.

To Microservices and Beyond!

1

Simon Elisha (@simon_elisha) - CTO & Director of Field Engineering

© Copyright 2014 Pivotal. All rights reserved. 2

IT SEEMS THERE’S SOME HYPE…

M!CR0S3RV!C3$!!!!!

© Copyright 2014 Pivotal. All rights reserved.

DEFINE: Microservice

3

Loosely coupled service oriented architecture with bounded contexts

If every service has to be updated in concert, it’s not loosely coupled!

If you have to know about surrounding services you don’t have a bounded context.

© Copyright 2014 Pivotal. All rights reserved. 4

Not Traditional (ESB-centric) SOA

Enterprise Service Bus

Service Service Service Service

Service Service Service Service

UI UI

© Copyright 2014 Pivotal. All rights reserved. 5

But Microservices!

© Copyright 2014 Pivotal. All rights reserved. 6

But why?

© Copyright 2014 Pivotal. All rights reserved. 7

Issues We’ll Confront•Microservices are not an inherently superior architecture.

•We’re still building big systems from smaller things.

• Just like Docker won’t save the world, neither will microservices. They’re not free.

• You absolutely cannot forget about data.

• Let’s begin!

© Copyright 2014 Pivotal. All rights reserved. 8

Not an end in themselves…It’s about Continuous Delivery!

© Copyright 2014 Pivotal. All rights reserved.

What is Continuous Delivery?

9

$Busin

ess

Devel

opm

ent

QA

Ope

ratio

nsCu

stom

er

© Copyright 2014 Pivotal. All rights reserved.

What is Continuous Delivery?

10

$

© Copyright 2014 Pivotal. All rights reserved. 11

Keep the Wheel Spinning!

Design Develop

Test

Customer Feedback Customer

Delivery

Analytics

© Copyright 2014 Pivotal. All rights reserved. 12

Prod Release #1

Prod Release #2

Prod Release #3

Agile Development

Waterfall Organization!

© Copyright 2014 Pivotal. All rights reserved.

Silo Delivery

13

Project Mgmt UX Dev QA DBA Sys

AdminNet

AdminStorage Admin

Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin

MONOLITHIC DELIVERY

© Copyright 2014 Pivotal. All rights reserved.

Continuous Delivery

14

Product Mgr UX Dev QA DBA Sys

AdminNet

AdminStorage Admin

BUSINESS CAPABILITY TEAMS USING MICROSERVICES

PLATFORM OPERATIONS TEAM

Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin

© Copyright 2014 Pivotal. All rights reserved.

Continuous Delivery

15

Product Mgr UX Dev QA DBA Sys

AdminNet

AdminStorage Admin

BUSINESS CAPABILITY TEAMS USING MICROSERVICES

PLATFORM OPERATIONS TEAM

Adapted from: http://www.slideshare.net/adriancockcroft/goto-berlin

Self Service

API

© Copyright 2014 Pivotal. All rights reserved. 16

INVENTORY

Prod Release

Prod Release

Prod Release

CATALOG

Prod Release

Prod Release

Prod Release

REVIEWS

Prod Release

Prod Release

Prod Release

SHIPPING

Prod Release

Prod Release

Prod Release

© Copyright 2014 Pivotal. All rights reserved. 17

Microservices Enabling Continuous Delivery•Decoupling Capabilities -> Decoupling Change Cycles

• Product Ownership: Tip to Tail

•We Build and Operate What We Understand BEST

•We Collaborate via API Contracts

•Microservice to Microservice

•Microservice to Platform

© Copyright 2014 Pivotal. All rights reserved. 18

Systems over ServicesComposition over Components

© Copyright 2014 Pivotal. All rights reserved.

Microframeworks for Microservices

19

Spring Boot http://projects.spring.io/spring-boot

Dropwizard http://dropwizard.io

© Copyright 2014 Pivotal. All rights reserved.

It can get pretty small…

20

@RestController class ThisWillActuallyRun { @RequestMapping("/") String home() { Hello World! } }

© Copyright 2014 Pivotal. All rights reserved.

With Spring Data REST!

21

http://projects.spring.io/spring-data-rest

@Entity @Table(name = "city") public class City implements Serializable {

@Id @GeneratedValue private Long id;

@Column(nullable = false) private String name;

@Column(nullable = false) private String county;

//...

}

© Copyright 2014 Pivotal. All rights reserved.

With Spring Data REST!

22

http://projects.spring.io/spring-data-rest

@RepositoryRestResource(collectionResourceRel = "cities", path = "cities") public interface CityRepository extends PagingAndSortingRepository<City, Long> {}

@Configuration @ComponentScan @EnableAutoConfiguration @EnableJpaRepositories @Import(RepositoryRestMvcConfiguration.class) public class Application {

public static void main(String[] args) { SpringApplication.run(Application.class, args); } }

© Copyright 2014 Pivotal. All rights reserved.

With Spring Data REST!

23

http://projects.spring.io/spring-data-rest

{ "_links" : { "next" : { "href" : "http://localhost:8080/cities?page=1&size=20" }, "self" : { "href" : "http://localhost:8080/cities{?page,size,sort}", "templated" : true } }, "_embedded" : { "cities" : [ { "name" : "HOLTSVILLE", "county" : "SUFFOLK", "stateCode" : "NY", "postalCode" : "00501", "latitude" : "+40.922326", "longitude" : "-072.637078",

© Copyright 2014 Pivotal. All rights reserved.

But No Microservice is an Island…

24

© Copyright 2014 Pivotal. All rights reserved.

Example Distributed System: Minified

25

© Copyright 2014 Pivotal. All rights reserved. 26

Some emergent features of microservices systems…

•Distributed/Versioned Configuration

• Service Registration/Discovery

• Routing/Load Balancing

• Fault Tolerance (Circuit Breakers, Bulkheads, …)

© Copyright 2014 Pivotal. All rights reserved.

Example: Coordination Boiler Plate

27

© Copyright 2014 Pivotal. All rights reserved. 28

• Eureka

•Hystrix + Turbine

• Ribbon

• Feign

• Zuul

•Archaius

+

http://netflix.github.io

© Copyright 2014 Pivotal. All rights reserved. 29

http://projects.spring.io/spring-cloud

© Copyright 2014 Pivotal. All rights reserved.

Example: Spring Cloud + Netflix OSS

30

© Copyright 2014 Pivotal. All rights reserved. 31

Operationalized ArchitectureYou have to pay for your lunch!

© Copyright 2014 Pivotal. All rights reserved.© Copyright 2014 Pivotal. All rights reserved. 32

http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html

© Copyright 2014 Pivotal. All rights reserved. 33

Paying for your lunch…• Significant Operations Overhead

• Substantial DevOps Skills Required

• Implicit Interfaces

•Duplication of Effort

•Distributed System Complexity

•Asynchronicity is Difficult!

• Testability Challenges

© Copyright 2014 Pivotal. All rights reserved.

You must be this tall to use Microservices…

34

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

https://www.flickr.com/photos/gusset/3723961589

• RAPID PROVISIONING

•BASIC MONITORING

• RAPID APPLICATION DEPLOYMENT

•DEVOPS CULTURE

© Copyright 2014 Pivotal. All rights reserved.

It takes a platform…

35

http://techblog.netflix.com/2013/01/optimizing-netflix-api.htmlhttp://techblog.netflix.com/2014/03/the-netflix-dynamic-scripting-platform.html

© Copyright 2014 Pivotal. All rights reserved.

It takes a platform…

36

Pivotal CF Spring Cloud

© Copyright 2014 Pivotal. All rights reserved. 37

Platform Features• Environment Provisioning

•On-Demand/Automatic Scaling

• Failover/Resilience

• Routing/Load Balancing

•Data Service Operations

•Monitoring

© Copyright 2014 Pivotal. All rights reserved.

Environment Provisioning/App Deployment

38

Rou

ter

Cloud Controller Service Broker Node(s)

DEA DEA

DEA DEA

Blobstore DB

Runtime

1. Upload bits/metadata

2. Create/bind services

3. Stage via Buildpack

4. Deploy via Container

push app+ app MD

SC

+ =

http://docs.cloudfoundry.org/devguide/deploy-apps/

© Copyright 2014 Pivotal. All rights reserved.

Environment Provisioning/App Deployment

39

Rou

ter

Cloud Controller

DEA

Blobstore DB

Runtime

Detect Compile UploadNo

System Buildpacks

+ =

Yes

http://docs.cloudfoundry.org/buildpacks/

© Copyright 2014 Pivotal. All rights reserved.

Deployment/Load Balancing/Scaling

40

Blobstore

R

oute

r Cloud Controller

DEA

Messaging (NATS)

DEA DEA

Runtime

Access App

http://docs.cloudfoundry.org/concepts/architecture/warden.html

Container Container

© Copyright 2014 Pivotal. All rights reserved.

Failover/Resilience

41

Blobstore

R

oute

r Cloud Controller

DEA

Messaging (NATS)

DEA DEA

Runtime

Health ManagerActual StateDesired State

http://docs.cloudfoundry.org/concepts/architecture/#hm9k

Container Container Container

© Copyright 2014 Pivotal. All rights reserved.

Data Service Operations: Cluster Provisioning

42

Blobstore

BOSH

Health Monitor

DBDeploy my Services

IaaS

Worker VMs BOSH Director

NATS Cassandra Node

Target VMCassandra Node

Target VMCassandra Node

Target VM

http://bosh.cloudfoundry.org/

© Copyright 2014 Pivotal. All rights reserved.

DB

Rou

ter

Data Service Operations: Application Binding

43

Service credentials

reserve resources

obtain connection data

CLI Cloud Controller

Service Broker

Data Service

Runtime

create service (HTTP)

bind service (HTTP)

create service (HTTP)

bind service (HTTP)

http://docs.cloudfoundry.org/services/api.html

© Copyright 2014 Pivotal. All rights reserved.

Monitoring

44

© Copyright 2014 Pivotal. All rights reserved. 45

It’s All About the DataWhat about the BIG QUESTIONS?

© Copyright 2014 Pivotal. All rights reserved.

This won’t work…

46

© Copyright 2014 Pivotal. All rights reserved. 47

Instead!

© Copyright 2014 Pivotal. All rights reserved.

Bounded Contexts

48

Movie Movie

Actor

Genre

Media Type

Media Type

Kiosk

Location

Media

Product Catalog

Inventory

© Copyright 2014 Pivotal. All rights reserved.

Polyglot Persistence

49

REST XYou shall not pass…

© Copyright 2014 Pivotal. All rights reserved.

But I have a question!

50

REST XYou shall not pass…

?

?

? ?

?

?

© Copyright 2014 Pivotal. All rights reserved.

Lambda Architecture

51

© Copyright 2014 Pivotal. All rights reserved.

Join via Events!

52

© Copyright 2014 Pivotal. All rights reserved. 53

http://projects.spring.io/spring-xd/

© Copyright 2014 Pivotal. All rights reserved. 54

© Copyright 2014 Pivotal. All rights reserved.

Redbox Conceptual Workflow

55

© Copyright 2014 Pivotal. All rights reserved.

SpringBox Microservices

56

Catalog Service

Inventory Service

Kiosk

Kiosk

Kiosk

Reservation Service

https://github.com/cf-platform-eng/springbox-datacloud

© Copyright 2014 Pivotal. All rights reserved.

…and if you have a question:

57

Kiosk

Kiosk

Kiosk

Speed Layer

Batch Layer Serving Layer

Event Ingest

https://github.com/cf-platform-eng/springbox-datacloud

“What movie genres are most popular in what geographic locations?”

© Copyright 2014 Pivotal. All rights reserved.

“What movie genres are most popular in what geographic locations?”

58

// Aggregate preferences across all kiosks: stream create --name kiosk_agg_prefs --definition "rabbit --queues=lambda.kiosk.events | field-value-counter --fieldName=genreIds"

// Tap aggregate preferences, filter for kiosk #1: stream create --name kiosk_1_prefs --definition "tap:stream:kiosk_agg_prefs > filter --expression=#jsonPath(payload,'$.locationId').equals(1) | field-value-counter --fieldName=genreIds"

© Copyright 2014 Pivotal. All rights reserved.

“What movie genres are most popular in what geographic locations?”

59

field-value-counter display --name kiosk_agg_prefs field-value-counter display=kiosk_agg_prefs ------------------------------------------- - ----- VALUE - COUNT Action | 14 Adventure | 6 Comedy | 27 Sci-Fi | 18

© Copyright 2014 Pivotal. All rights reserved. 60

Where We’ve Been…•Microservices are an enabler to Continuous Delivery.

• Less about services, more about composed distributed systems. Patterns can help.

• You’re going to need a platform.

•Decomposed data governance -> recomposed data discovery.

• Thank You!

A NEW PLATFORM FOR A NEW ERA

top related