api centric patterns

43
Patterns For API Centric Architecture Daniel Cerecedo @dcerecedo

Upload: daniel-cerecedo

Post on 29-Jul-2015

167 views

Category:

Software


0 download

TRANSCRIPT

Page 1: API Centric Patterns

PatternsForAPI CentricArchitecture

Daniel Cerecedo@dcerecedo

Page 2: API Centric Patterns

Byteflair

StatelessStateless

Page 3: API Centric Patterns

Byteflair

StatelessStateless

Client/Server

Page 4: API Centric Patterns

Byteflair

StatelessStateless

It's all about CLIENT STATE,not about the

global state of the system

Page 5: API Centric Patterns

Byteflair

StatelessStateless

Client requests provideALL the context thatthe Server needs to

Determine Client state

Page 6: API Centric Patterns

Byteflair

StatelessStateless

The state of the client is part of the payload

Page 7: API Centric Patterns

Byteflair

StatelessStateless

Stateless servers are core to

HORIZONTAL SCALING

Page 8: API Centric Patterns

Byteflair

Page 9: API Centric Patterns

Byteflair

Common ContractCommon Contract

Exchange protocol

Message format

Page 10: API Centric Patterns

Byteflair

Common ContractCommon Contract

Exchange protocol

Message format

Coupling

Page 11: API Centric Patterns

Byteflair

Common ContractCommon Contract

Page 12: API Centric Patterns

Byteflair

Page 13: API Centric Patterns

Byteflair

OrchestrationOrchestration

2

1

3

Page 14: API Centric Patterns

Byteflair

OrchestrationOrchestration

2

1

3

Page 15: API Centric Patterns

Byteflair

Mediation RouterMediation Router

Page 16: API Centric Patterns

Byteflair

Mediation RouterMediation Router

Intelligently ROUTES and TRANSFORMS messages, and

handles endpoint ERRORS

Page 17: API Centric Patterns

Byteflair

Mediation RouterMediation Router

✔ Load BalancerSpecify a group of components among which to load balance requests

✔ Dead LetterDeclare error conditions, retry policies and where to deliver the message on failure

✔ Content Based RoutingRoute a message to different endpoints based of its contents

✔ Dynamic RouterRoute a message to different endpoints based on the state of the system

✔ NormalizerTransform messages from heterogeneous formats into a common format

Page 18: API Centric Patterns

Byteflair

Mediation RouterMediation Router

Page 19: API Centric Patterns

Byteflair

Mediation RouterMediation Router

Page 20: API Centric Patterns

Byteflair

Page 21: API Centric Patterns

Byteflair

Message BrokerMessage Broker

A Message Broker supportsALL communication models:✔ Publish/Subscribe✔ Sync RPC✔ Async RPC

Page 22: API Centric Patterns

Byteflair

Message BrokerMessage Broker

A Message BrokerGUARANTEES the delivery

of a message

Page 23: API Centric Patterns

Byteflair

Page 24: API Centric Patterns

Byteflair

Service RegistryService Registry

Netflix Eureka

Page 25: API Centric Patterns

Byteflair

Service RegistryService Registry

Page 26: API Centric Patterns

Byteflair

Page 27: API Centric Patterns

Byteflair

Load BalancerLoad Balancer

Netflix Ribbon

Page 28: API Centric Patterns

Byteflair

Page 29: API Centric Patterns

Byteflair

Circuit BrakerCircuit Braker

Netflix Hystrix

Page 30: API Centric Patterns

Byteflair

Service DiscoveryService Discovery

Page 31: API Centric Patterns

Byteflair

Service DiscoveryService Discovery

Discovery client automatically resolves service names through the service registry

Page 32: API Centric Patterns

Byteflair

Service DiscoveryService Discovery

Client load balancer caches service instance locations to support service resolution in case the registry failure

Page 33: API Centric Patterns

Byteflair

Service DiscoveryService Discovery

Client load balancer selects a service instance among all available

Page 34: API Centric Patterns

Byteflair

Circuit BreakerCircuit Breaker

If we are unable to service a request we can shortcircuit and fallback graciously

Page 35: API Centric Patterns

Byteflair

StatelessService Discovery

Load BalancerCircuit Braker

Micro Services

Page 36: API Centric Patterns

Byteflair

Micro ServicesMicro ServicesMy wayMy way

Page 37: API Centric Patterns

Byteflair

Micro ServicesMicro ServicesMy wayMy way

Page 38: API Centric Patterns

Byteflair

ContainerizationContainerization

Page 39: API Centric Patterns

Byteflair

ContainerizationContainerization

Strict separation betweenbuild, release and run.

Releases are APPEND ONLY

Page 40: API Centric Patterns

Byteflair

ContainerizationContainerization

Infrastructure is IMMUTABLE

Page 41: API Centric Patterns

Byteflair

ContainerizationContainerization

Services are exportedvia PORT BINDING

Page 42: API Centric Patterns

Byteflair

ReferencesReferences

Spring CloudUsing cloud components with spring, specially Netflix OSShttp://projects.spring.io/spring-cloud/Flux CapacitorJava-based, cloud-native, reference architecture using many Netflix Open Source projectshttps://github.com/cfregly/fluxcapacitor12 Factor APPMethodology for building software-as-a-service appshttp://12factor.net/ShipyardComposable docker managementhttp://shipyard-project.com/

Page 43: API Centric Patterns

?ThanksThanksMerciMerciGraciasGracias

http://byteflair.comDaniel Cerecedo

@dcerecedo