+ All Categories
Home > Engineering > Design patterns in distributed system

Design patterns in distributed system

Date post: 07-Jan-2017
Category:
Upload: tom-huynh
View: 75 times
Download: 2 times
Share this document with a friend
20
Design Patterns in Distributed System Tom Huynh [email protected]
Transcript
Page 1: Design patterns in distributed system

Design Patterns in Distributed System

Tom Huynh

[email protected]

Page 2: Design patterns in distributed system

Agenda

O What is distributed system?

O CAP theorem

O Fallacies of Distributed system

O Some distributed design problems and solutions

O CQRS & Event Sourcing

O Enterprise Service Bus

O Publisher/Subscriber pattern

O Demo pub/sub pattern in AngularJS SPA

O QA

Page 3: Design patterns in distributed system

What is Distributed System?

N1 N2

N3 N4

LAN/WAN Fiber, cable, satellite, etc

Page 4: Design patterns in distributed system

CAP theorem

O Consistency

O Availability

O Partition Tolerance

1

4

2

3

Can have ONLY maximum 2 promises at same time

Page 5: Design patterns in distributed system

CAP theorem - Proof

1 2

Page 6: Design patterns in distributed system

Fallacies of Distributed system

O Network is reliable.

O Latency is zero.

O Bandwidth in infinite.

O Network is secure.

O Topology does not change.

O There is one administrator.

O Transport cost is zero.

O Network is homogeneous.

Page 7: Design patterns in distributed system

CAP Theorem - Fallacies

O Network not reliable

O Latency is zero

O Bandwidth is infinite

O Network is secure

O Topology doesn’t change

O 1 administrator

O Transport cost is zero

O Network is homogeneous

O Consistency

O Availability

O Partition Tolerance

Page 8: Design patterns in distributed system

CAP Theorem - Fallacies

Page 9: Design patterns in distributed system

Agenda

O What is distributed system?

O CAP theorem

O Fallacies of Distributed system

O Some distributed design problems and solutions

O CQRS & Event Sourcing

O Enterprise Service Bus

O Publisher/Subscriber pattern

O Demo pub/sub pattern in AngularJS SPA

O QA

Page 10: Design patterns in distributed system

CQRS

O A pattern

O Not an architecture

O Not an architectural style

O Not a principle

O Command Query Responsibility Segregation

O Domain applicable

Page 11: Design patterns in distributed system

CQRS - Durability (Cont.)

Page 12: Design patterns in distributed system

CQRS - Scaling (Cont.)

Page 13: Design patterns in distributed system

Event Sourcing

Page 14: Design patterns in distributed system

Enterprise Service Bus

Page 15: Design patterns in distributed system

ESB – 2 kinds

O Decentralized

O Independently configurable services

O Collaboration among teams

O Services make all decisions

O NServiceBus

O MassTransit

O Rhino Service Bus

O BrokeredO Single point of config

O Single governing body

O Middleware makes some decisions

O TIBCO

O BizTalk

O Web Sphere

Page 16: Design patterns in distributed system

Publisher/Subscriber pattern

O Problem:

O How an application send messages to other applications that are interested in receiving the messages without knowing the identities of the receivers?

O Tight coupling of sender and receiver applications

O Solution: P/SSender

Receiver 2

Receiver 1

Page 17: Design patterns in distributed system

Publisher/Subscriber pattern

Publisher

Event 1

Event 2

SubScriber1

SubScriber1

SubScriber1

Page 18: Design patterns in distributed system

Pub/sub demo

O AngularJS

O Controllers

Root scope

Scope 2Scope 1

Scope 4Scope 3

Page 19: Design patterns in distributed system

Reference

O Farm Credit Service of America knowledge base.

O Presentations of Michael L Perry, Dino Esposito, Greg Young, etc.

Page 20: Design patterns in distributed system

Q&A


Recommended