Distributed Applications
Software Engineering 2017 Alessio Gambi - Saarland University
Based on the work of Cesare Pautasso, Christoph Dorn, and other sources
Distributed Applications Software Engineering 2017 Alessio Gambi - - - PowerPoint PPT Presentation
Distributed Applications Software Engineering 2017 Alessio Gambi - Saarland University Based on the work of Cesare Pautasso, Christoph Dorn, and other sources ReCap Software Architecture A software systems architecture is the set of
Software Engineering 2017 Alessio Gambi - Saarland University
Based on the work of Cesare Pautasso, Christoph Dorn, and other sources
Abstraction Communication Visualization and Representation Quality Attributes
Every system a software architecture has What designers want
Web Browser Front End App Server Back End
Backend Parser ArticleEdit Reads Writes ArticleView Submit Logic UI Page Skinning Localization Static Resources
Backend Parser ArticleEdit Reads Writes ArticleView Submit Logic UI Page Skinning Localization Parser Cache Static Resources Loader Cached Cached Cached Job Runner Writes Job Queue HTML File Cache Precompile/Recompile Regenerate/Invalidate
Static and Lazy instances Leasing Per-request instances Pooling Client-dependent instances Passivation
Server Process Machine Boundary Process B Client Object Server Application
n-1) shutdown n) destroy 1) create 3) invoke
Process A Client
2) invoke
Remote object instances exist independently of any clients They last as long as their container (server)
Server Process Machine Boundary Servant for Obj X Server Application Process A Client
3) Invoke
Invoker
1) create 4) create 5) invoke 2) register Object “X”
Instantiate object upon first request Save computational resources
Server Process Machine Boundary Process B Client Servant for Obj X Server Application
3) Invoke
Process A Client
2) Invoke
Invoker
1) create
Servant for Obj X
2a) create 2b) invoke 2c) destroy 3a) create 3b) invoke 3c) destroy
Each request processed by a fresh instance Provide max logical isolation (but high cost)
Server Process Process B Client Object Server Application
5a) new Instance
Process A Client
2a) new Instance
Remote Factory
1) create
Object
2b) create 5b) create 3) invoke 4) invoke 6) invoke
Requests from the same client processed by the same instance (but there might be a one-to-many mapping) Remote objects extend client logic and share its state
Server Process Object “X” Lifecycle Manager Process A Client
4) Invoke
Invoker
3) create lease 1) Create X 4) renew lease 5) invoke 2) create After lease expired: 6) destroy
Avoid removal of per-client objects when not used by periodically renew the lease
Maintain a (possibly dynamic) set of generic objects to serve clients requests Clean up state before returning to the pool
Server Process Machine Boundary Servant for X Server Application Process A Client
4) Invoke
Invoker
1) create 6) invoke 3) register pooled instance “X”
Object Pool “X” Servant for X Servant for X Servant for X
2) create 7) put servant back 5) get idle servant
Server Process Servant for “X” Lifecycle Manager Process A Client
1a,4) Invoke on Obj X
Invoker
5) activate (objId) 1b,8) invoke 7a) create 7b) activate After timeout 2a) passivate 2b) destroy 3) storeState (objId) 6) getState (objId)
Save resources by freezing “per-client” objects Objects are reactivated upon first request
Fire and Forget Poll Object Sync with Server Callback
Process A Process B Machine Boundary Client Requestor Invoker
1) invoke 2b) send 2a) return
Best effort (or nobody cares) semantics
Process A Process B Client Requestor Invoker
1) invoke 2) send 3b) return
Object
3a) reply 3c) invoke
Requestor ensures that the request correctly arrived to server (but not processed) Delivery confirmation semantics
Local stub on client’s machine checks if results are ready
Process A Process B Client Requestor Invoker
1) invoke 2) invoke 3) isAvailable = false
Poll Object
6) getResult 4) storeResult 5) isAvailable = true
Execute code whenever the remote request returns
Process A Process B Client Requestor Invoker
2) invoke 3) invoke
Callback Object
4) finished(result) 1) create 5) execute
no specific roles local/distributed
no specific roles mostly distributed local/distributed
Messaging Middleware Sender Receiver Receiver Receiver Queue Queue Send Message Receive Message Receive Reply Send Reply
Messaging Middleware Sender Receiver Receiver Receiver Queue Queue Send Message Receive Message Receive Reply Send Reply
consumer
persistence and decoupling (async)
MOMs enable both request-only and request-reply interactions despite sender/receiver do not know each
MOMs enable both request-only and request-reply interactions despite sender/receiver do not know each
Uniquely identify a request message (ID) Correlation between the requests and replies MessageType=REQUEST|REPLY & MessageID = ID
Content-based, Dynamic
Message filter
Splitter, Aggregator
Normalizer, Content Enricher, Content Filter
Envelope wrapper
Destination decided using the payload
Destination not fixed but chosen using rules
Remove un-needed messages
Decompose a composite message in parts
Use the parts to create a composite message
Filter from a composite message unneeded payload
Use additional data to augment messages
Route messages to translators which transform the to a common format
Bridged delivery via wrapping messages into other messages
link multiple messaging systems to make messages exchanged on one also available on the others
transport
simple/primitive, complex
stock markets, twitter
video, audio
Streaming Source Streaming Sink Streaming Sink Streaming Sink MW
Unicast or multicast communication channels No discrete unit of interaction (request/response) Low overhead, but mostly transport/communication
Time matters (e.g., minimum transfer rate)
Sequence matters (e.g., no specific transfer rate)
Time matters (e.g., minimum transfer rate)
Sequence matters (e.g., no specific transfer rate)
Time is essence (e.g., both min and max transfer rate)
Incoming streams Streaming data m Output complex messages m3 m2 m1 … … … s3 s2 s1
m1 … s1 m2 … s2 m3 … s3
Streaming data s Complex stream/multiple streams data processing Application-specific data processing
POJO, Maps, Object-Arrays, XML, etc..
events processes as they arrive and sent to output
both incoming and outgoing events
describe conditions, transformations, etc.
https://docs.oracle.com/cd/E13157_01/wlevs/docs30/epl_guide/overview.html
Specify interests on certain types of events
event-patterns, correlations of events, and more
High-level language SQL-like
standard and new clauses
Streams replace tables; events replace rows
it’s just an analogy
Statements target single and multiple data streams
https://docs.oracle.com/cd/E13157_01/wlevs/docs30/epl_guide/overview.html
SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY
INSERT INTO
RETAIN, MATCHING, OUTPUT
virtual window (constraint amount of data)
sequence of events (logical and temporal operators)
control/stabilize the output rate
Incoming events processed through sliding windows
Size of window limits the maximum number of events
Conditions expressed on the window and events
Tight coupling
Loose coupling
Client requires library
Message exchanges
Client / Server
Peer-to-peer
Extendable
Composable
Fast
Some overhead
Small/Medium Medium/Large Buy and install
Pay-per-use
Local
Remote
build systems out of the composition of existing ones
WSCI, BPML, BPEL4WS, BPSS, XPDL
WSDL, XML, HTTP, JSON, SMTP, FTP, …
SOAP + WS-*, HTTP+RESTFul
link multiple messaging systems to make messages exchanged on one also available on the others
https://www.slideshare.net/kumargaurav66/oracle-soaand-bpm
https://i.stack.imgur.com/WQsEJ.jpg
Application Resource URI
HTTP GET HTTP POST HTTP PUT HTTP DEL JSON ...
Application Endpoint URI
SMTP HTTP ... MQ SOAP (WS-*)
http://webtechsharing.com/soap-vs-rest/
and distribute functions and data (lifecycle)
method (different patterns/styles for different parts)
principles-of-microservices-ndc-2014
Distributed Object Middleware, Wiley Series in Software Design Patterns, 2004
Hall, 2005
top.htm
Databases and the NoSQL Movement
http://www.espertech.com/esper/release-5.0.0/esper-reference/html_single/index.html