Service Oriented Architecture Vs Monolithasaurus

Preview:

DESCRIPTION

SOA is an approach to application design that allows us to build robust, scalable software. This is not about scary enterprise systems, this is about building applications with interoperable, lean services that can provide incredible flexibility and freedom. You will learn the pros (and cons) of this approach, and how you can apply it to your own projects. Using common idioms like REST, HTTP and message queues, complex applications can appear simple again. Simplicity leads to better design, increased agility and developer happiness.

Citation preview

serviceoriented

architecture

serviceoriented

architecture

Working memory

Fight back!- Solid OO techniques- Refactoring- Paying back technical debt- Test driven development- Continuous integration

Easy to change

Service Oriented

Architecture

SOABuild applications

out of smaller ones

Services =

HTTP =

REST+

Message queues

REST

Message queues

SQS, RabbitMQ, ActiveMQ, Resque, etc

OO principles - Single responsibility- Loose coupling- Cohesion- Encapsulation

Real world?There are no rules

auth

users

front-end

blog

socialreviews

recommendations

stock shippingpayments

tagsbaskets

history

Online record shop

Extract functionality

intoservices

Reviews

Recommendations

Product info

Stock levels

reviews-service

REST + JSON

reviews-serviceGET /reviews/idPOST /reviewsPATCH /reviews/idDELETE /reviews/id

reviews-serviceGET /reviews/id

{ json }

reviews-servicePOST /reviews

{ json }

reviews-service

{ json }

BONUS: Client-side rendering!

reviews-serviceapplication/json

text/html

Isolated

Reusable

Interoperable

Agile

Scalable

Robust

Shipping

shipping-service

Shop Shipping-service

Message queue

{ order details }

/api/shippings

IsolatedReusable

InteroperableAgile

ScalableRobust

hydra.ioAPI for building &

profiting from digital image apps

/uploads /products /orders/artworks

imageprocessing

hydra.io

/uploads /products /orders/artworks

imageprocessing

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

hydra.io

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

hydra.io

api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

hydra.io

api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

admin tools

api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

admin tools

api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

admin tools

backbone.js

hydra gem

api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)api.hydra.io proxy (HAProxy)

/uploads /products /orders/artworks

imageprocessing MongoDB MongoDB MongoDB

S3

message queue (resque)

Small, sharp tools

SOA is Lego

for developers

Change is easyChange is hard

PrefactoringDraw pictures &

simplify

When to extract into services?Mature functionality

EnvironmentsStaging

http://12factor.net/

Deployments

Caching at every layer

Performance

- Test in isolation- Integration tests

Testing

Everything

Automate

Warning!

Polyglot?

Reuse & Consistency

Nooo!

Centralised Database

Keep checking the big picture

/api/v2/gorillas

Versioning

Parallel HTTP requests

Small steps

Conclusions

1. Discipline pays

2. Minimise coupling

3. Small services

4. Reduce complexity

5. Check the big picture

START SMALLSTAY SMALL

The future

Recommended