application patterns
DESCRIPTION
Basic application design patterns for web, batch and integration applications in diagrams. Languages, technologies, platforms are changing, but in each environment we recognize the same patterns and solutions.TRANSCRIPT
Application Patterns tomi vanek
February 2014
Copyright © 2014 Accenture All rights reserved. 2
• User Interaction
• Services
• Persistence – scaling, locking, cache
• Real-time processing
• High Volume Batch Processing
Agenda
User Interaction
Copyright © 2014 Accenture All rights reserved. 4
MVP
MVC / MVP / MV-VM
Model
View Controller Action
Model
View Presenter Action
Model
View
View-Model Action
MVC
MV-VM
Copyright © 2014 Accenture All rights reserved. 5
Model-View-Controller (MVC)
Copyright © 2014 Accenture All rights reserved. 6
MVC Variant: Page Flow
Copyright © 2014 Accenture All rights reserved. 7
Page flow with asynchronous
commit of order
Simple synchronous MVC
implementation
MVC: Page Flow Example
Copyright © 2014 Accenture All rights reserved. 8
In-Memory Server Session State
Copyright © 2014 Accenture All rights reserved. 9
Persistent Session State
Copyright © 2014 Accenture All rights reserved. 10
Serialized Session State in View
Copyright © 2014 Accenture All rights reserved. 11
Client Session State in Local Storage
Services
Copyright © 2014 Accenture All rights reserved. 13
Method invocation / Resource manipulation
• Services: – Strongly typed interface
contract.
– Broad range of aspects are standardized.
– Implemented in integration infrastructure and technologies.
– Service discoverability and lifetime management.
• But: – Limits in scalability.
– Expensive extensibility.
• Resources:
– Simple data exploration.
– Simple extensibility.
– Simple data consumer
code.
• But:
– Limited schema
definition.
– No standards for
complex functionalities /
scenarios.
Copyright © 2014 Accenture All rights reserved. 14
Business Layer Remote Procedure Call
Presentation
Presentation Layer
Business Tier Data Tier
External
Business Module
Resources Data Layer Business Layer
External
System
Repository
Integration Gateway
Service
Service
Relational Database
Copyright © 2014 Accenture All rights reserved. 15
Compact Business Layer with Active Records
Application Tier
Dynamic
Presentation Module
Presentation Layer Resources Domain Layer
Presentation
Data Tier
External
External
System
Integration Gateway
Relational Database
Copyright © 2014 Accenture All rights reserved. 16
REST / WS Business Layer
Presentati
on
Business Tier Data Tier
External
Business Module
Resources Data Layer Business Layer Presentation Layer
External
System
Repository
Integration Gateway
Service
Service
Relational Database C
on
troller
Copyright © 2014 Accenture All rights reserved. 17
Asynchronous Business Layer
Presentation
Business Tier Data Tier
External
Business Module
Resources Data Layer Business Layer Presentation Layer
External
System
Repository Relational Database
Integration Gateway
Queue
Queue
Service
Queue
Queue
Service
Copyright © 2014 Accenture All rights reserved. 18
Push Notification Business Layer
Presentation
Business Tier
Business Module
Resources Data Layer Business Layer Presentation Layer
Subject Register
Service
Copyright © 2014 Accenture All rights reserved. 19
Data synchronization
Persistence - Scaling
Copyright © 2014 Accenture All rights reserved. 21
Database Scaling: Master – Slave
Internet
Load Balancer
Load Balancer
Slaves
Web Servers
Master
Write Read
Replicate
Copyright © 2014 Accenture All rights reserved. 22
Database Scaling: Active - Passive
Internet
Load Balancer
Passive
Web Servers
Failed
Active Instance
Passive to Active
Instance
Replicate
Read / Write
Copyright © 2014 Accenture All rights reserved. 23
Database Scaling: Cluster
Internet
Load Balancer
Virtual Database
Cluster
Controller
Virtual Database
Cluster
Controller
Copyright © 2014 Accenture All rights reserved. 24
Database Scaling
Load Balancer
Shard Resolver
Web Servers
Product 1 .. n
Product n+1 .. o
Product o+1 .. p
Locking
Copyright © 2014 Accenture All rights reserved. 26
Optimistic Locking
Copyright © 2014 Accenture All rights reserved. 27
Pessimistic Locking
Cache
Copyright © 2014 Accenture All rights reserved. 29
Read-through / Write-through Cache
Copyright © 2014 Accenture All rights reserved. 30
Pre-fetch
Copyright © 2014 Accenture All rights reserved. 31
Publisher
Real-time processing Integration Patterns
Copyright © 2014 Accenture All rights reserved. 33
Reference model
34
Messaging Idioms
• Channels
• Message Construction
• Rooting
• Transformation
Messaging Design Patterns
• Pipes and Filters
• Claim Check
• Scatter-Gather
Integration Application Architecture Design Patterns
Copyright © 2014 Accenture All rights reserved. 35
Pipes and filters
Copyright © 2014 Accenture All rights reserved. 36
Pipeline
Copyright © 2014 Accenture All rights reserved. 37
Claim-check
Copyright © 2014 Accenture All rights reserved. 38
Claim-check for secure communication
Copyright © 2014 Accenture All rights reserved. 39
Scatter-Gather with Publish-Subscribe Input Channel
Copyright © 2014 Accenture All rights reserved. 40
Scatter-Gather with Recipient List
Scale-Out Batch High Volume Batch Processing
Copyright © 2014 Accenture All rights reserved. 42
Batch Application Elements
Job
Launcher Job Step
Reader
Processor
Writer
Job Repository
Copyright © 2014 Accenture All rights reserved. 43
Batch reference model
Copyright © 2014 Accenture All rights reserved. 44
Scaling
Copyright © 2014 Accenture All rights reserved. 45
Job with Parallel Steps
Copyright © 2014 Accenture All rights reserved. 46
Step with parallel threads
Copyright © 2014 Accenture All rights reserved. 47
Partitioning
Copyright © 2014 Accenture All rights reserved. 48
Remote chunking
Discussion