Architectural Patterns (3)



Similar documents
Deployment Pattern. Youngsu Son 1,JiwonKim 2, DongukKim 3, Jinho Jang 4

Applying Design Patterns in Distributing a Genetic Algorithm Application

Chapter 3 Chapter 3 Service-Oriented Computing and SOA Lecture Note

Useful Patterns for BPEL Developers

Scientific versus Business Workflows

Implementing Enterprise Integration Patterns Using Open Source Frameworks

A MODEL OF HETEROGENEOUS DISTRIBUTED SYSTEM FOR FOREIGN EXCHANGE PORTFOLIO ANALYSIS

Enterprise Integration Patterns

Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering

CHAPTER 4: PATTERNS AND STYLES IN SOFTWARE ARCHITECTURE

Patterns in a Nutshell

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur

I219 Software Design Methodology

Patterns in Software Engineering

How To Build A Message Based Application Integration System

Lecture 26 Enterprise Internet Computing 1. Enterprise computing 2. Enterprise Internet computing 3. Natures of enterprise computing 4.

Introduction. Observation Patterns. Accounting Patterns. How to use Patterns

A Robust Dynamic Load-balancing Scheme for Data Parallel Application on Message Passing Architecture

Programming Without a Call Stack: Event-driven Architectures

ATHABASCA UNIVERSITY. Enterprise Integration with Messaging

Developing SOA solutions using IBM SOA Foundation

Excerpts from Chapter 4, Architectural Modeling -- UML for Mere Mortals by Eric J. Naiburg and Robert A. Maksimchuk

Service-Oriented Architectures

Software Adaptation Patterns for Service-Oriented Architectures

SCALABILITY AND AVAILABILITY

Principles and Foundations of Web Services: An Holistic View (Technologies, Business Drivers, Models, Architectures and Standards)

A standards-based approach to application integration

Drupal in the Cloud. Scaling with Drupal and Amazon Web Services. Northern Virginia Drupal Meetup

Process Execution Engine

Scalable Application. Mikalai Alimenkou

Software Architecture and Patterns for Electronic Commerce Systems

A distributed system is defined as

Building a Reliable Messaging Infrastructure with Apache ActiveMQ

Service Virtualization: Managing Change in a Service-Oriented Architecture

WELCOME. Where and When should I use the Oracle Service Bus (OSB) Guido Schmutz. UKOUG Conference

Network File System (NFS) Pradipta De

Manager-Agent and Remote Operation: Two Key Patterns for Network Management Interfaces

GenericServ, a Generic Server for Web Application Development

Enterprise Integration Patterns

Distributed systems. Distributed Systems Architectures

Achieving Rolling Updates & Continuous Deployment with Zero Downtime

SOA Blueprints Concepts

Understanding Service-Orientation Part II: The Principles

SOA Standards - Patterns

Web application Architecture

Software Engineering. Software Engineering. Component-Based. Based on Software Engineering, 7 th Edition by Ian Sommerville

Session 6 Patterns and best practices in SOA/REST

SERVICE ORIENTED ARCHITECTURE

A Process View on Architecture-Based Software Development

What You Need to Know About Transitioning to SOA

Name of pattern types 1 Process control patterns 2 Logic architectural patterns 3 Organizational patterns 4 Analytic patterns 5 Design patterns 6

Outlook. Corporate Research and Technologies, Munich, Germany. 20 th May 2010

Ikasan ESB Reference Architecture Review

Stock Trader System. Architecture Description

Business Process Modelling Languages

Using MDA in Web Software Architectures

Processing of Hadoop using Highly Available NameNode

Titolo del paragrafo. Titolo del documento - Sottotitolo documento The Benefits of Pushing Real-Time Market Data via a Web Infrastructure

Enterprise Integration Patterns

Architecture. Reda Bendraou

Six Strategies for Building High Performance SOA Applications

Architectural Patterns: From Mud to Structure

WELCOME TO Open Source Enterprise Architecture

An Automatic Reversible Transformation from Composite to Visitor in Java

Service-Oriented Architecture and Software Engineering

MAPREDUCE Programming Model

RUP Design. Purpose of Analysis & Design. Analysis & Design Workflow. Define Candidate Architecture. Create Initial Architecture Sketch

Home - Enterprise Integration Patterns

High Availability Solutions for the MariaDB and MySQL Database

Business Process Execution Language for Web Services

Introduction to DISC and Hadoop

Pipeline Orchestration for Test Automation using Extended Buildbot Architecture

Techniques for Composing REST services

Business Process Driven SOA using BPMN and BPEL

Technical Track Session Service-Oriented Architecture

Liferay Portal Performance. Benchmark Study of Liferay Portal Enterprise Edition

SOA Myth or Reality??

Teaching Software Engineering Through Game Design

ILOG JRules Performance Analysis and Capacity Planning

Designing Real-Time and Embedded Systems with the COMET/UML method

Efficiency Considerations of PERL and Python in Distributed Processing

Di 6.1a. Warum naive SOA scheitert Ein Erfahrungsbericht. Adam Bien. January 26-30, 2009, Munich, Germany ICM - International Congress Centre Munich

Enterprise Integration Patterns with BizTalk Server 2004

FAQ: BroadLink Multi-homing Load Balancers

Availability Digest. MySQL Clusters Go Active/Active. December 2006

Hadoop IST 734 SS CHUNG

Administration Guide for the System Center Cloud Services Process Pack

ARCHITECTURAL DESIGN OF MODERN WEB APPLICATIONS

Distributed Systems Lecture 1 1

Transcription:

Scatter/Gather Architectural Patterns (3) Prof. Cesare Pautasso http://www.pautasso.info cesare.pautasso@usi.ch @pautasso Goal: send the same message to multiple recipients which will (or may) reply to it combine the notification of the request with aggregation of replies Pattern: broadcast a message to all recipients, wait for all (or some) answers and aggregate them into a single message Composition Scatter/Gather 1. Scatter/Gather 2. Canary Call Scatter/ Gather A B C 3. Master/Slave 4. Load Balancing 5. Composition Broadcast Request Aggregate Results Broadcasting can be implemented using subscriptions (loosely coupled) or a distribution list provided by the client (which knows A, B, C) Results will be collected and aggregated before they are returned to the original client as a single message

Scatter/Gather This is a simple composition pattern, where we are interested in aggregating replies of the components processing the same message. Alternatives for controlling the components: The recipients can be discovered (using subscriptions) or be known a priori (distribution list attached to request) Warning: the response-time of each component may vary and the response-time of the scatter/gather is the slowest of all component responses Different synchronization strategies: Wait for all messages Wait for some messages (within a certain time window, or using an N- out-of-m synchronization) Return fastest reply (discriminator, maybe only under certain conditions) Example: Contact N airlines simultaneously for price quotes Buy ticket from either airline if price<=200 CHF Buy the cheapest ticket if price >200 CHF Make the decision within 2 minutes Canary Call Goal: avoid crashing all recipients of a poisoned request use an heuristic to evaluate the request Pattern: try the potentially dangerous requests on one recipient and scatter the request only if it survives! Scatter/ Gather Canary Call A There is a chance that scattering the request, will result in crashing the workers receiving it. B C

Canary Call Master/Slave Scatter/ Gather A B C Goal: speed up the execution of long running computations split a large job into smaller independent partitions Try Request which can be processed in parallel If it worked scatter in parallel Retry Request Pattern: the master divides the work among a pool of slaves and gathers the results once they arrive. Synonyms: Master/Worker, Divide-and-Conquer. The first parallel request is sent before all others to check if it would harm the worker receiving it (canary request). The decision on whether all other requests should be scattered depends on an heuristics: continue if the canary request is successful after some attempts. Performance/Robustness Trade-Off: Decreased Performance: the scatter phase waits for the canary call to succeed (response time doubles) Increase Robustness: most workers survive a poisonous call, which would have failed anyway Apply when worker recovery is expensive, or when there are thousands of workers involved Heuristic: Failed canary calls are not necessarily poisonous Assign to Slaves Merge Results Master/Slave Master Partition Slave A Slave B Assignment to slaves can be implemented using push or pull. The set of slaves is not known in advance and may change over time. Results will be collected and aggregated before they are returned to the original client

Master/Slave This composition pattern is a specialized version of the scatter/gather pattern. s should not know that the master delegates its task to a set of slaves Master Properties: Different partitioning strategies may be used Fault Tolerance: if a slave fails, resend its partition to another one Computational Accuracy: send the same partition to multiple slaves and compare their results to detect inaccuracies (this works only if slaves are deterministic) Master is application independent Slave Properties: Each slave runs its own thread of control Slaves may be distributed across the network Slaves may join and leave the system at any time (may even fail) Slaves do not usually exchange any information among themselves Slaves should be independent from the algorithm used to partition the work Example Applications: Matrix Multiplication (compute each row independently) Movie Rendering (compute each picture frame independently) TSP Combinatorial Optimization (local vs. global search) Load Balancing Goal: speed up and scale up the execution of multiple requests of many clients deploy many replicated instances of the server on multiple machines Pattern: the master assigns the requests among a pool of workers, which answer directly to the clients. Assign to Worker Load Master Worker A Worker B Balancer Different load balancing policies can be used by the master to distribute requests among a pool of workers. The set of workers is not known in advance and may change over time. Results will be sent directly by the worker back to the client (but may have to go through the master)

Load Balancing This composition pattern is similar to the master/worker pattern, but there is no partitioning of the request nor aggregation of the response s should not know that the master delegates its task to a set of workers Master Properties: Different load balancing policies may be used Fault Tolerance: if a slave fails, resend the request to another one (assuming idempotent failed requests can be detected by the master) Master and load balancing policies are application independent Worker Properties: Each worker runs its own thread of control Workers may be distributed across the network Workers may join and leave the system at any time (may even fail) Workers do not usually exchange any information among themselves Workers should be independent from the algorithm used to load balance the requests Variants: Stateless load-balancing (every request from any client goes to any worker) Session-based load-balancing (requests from the same client always go to the same worker) Elastic load balancing (the pool of workers is dynamically resized based on the amount of work) Composition Goal: Improve reuse of existing applications Build systems out of the composition of existing ones Pattern: by including compositions as an explicit part of the architecture, it becomes possible to reuse existing services in order to aggregate basic services into value-added ones Variants: Synchronous, Asynchronous Synonym: Orchestration Initiate Completion (Final result) Notification Composite (Web) (Extranet) Composite services provide value-added services to clients by aggregating a set of services and orchestrating them according to a well-defined and explicit business process model (Intranet)

Composition Composition is recursive: a composite service is a service that can be composed. s involved in a composition do not necessarily have to know that they are being orchestrated as part of another service and may be provided by different organizations s can be reused across different compositions and compositions can be reused by binding them to different services Composite services may be implemented using a variety of tools and techniques: Ordinary programming languages (Java, C#,...) Scripting languages (Python, PERL,...) Workflow modeling languages (JOpera, BPEL...) Compositions may be long-running processes and involve asynchronous interactions (both on the client side, and with the services) More Free Advice Most software systems cannot be structured according to a single architectural pattern. Choosing one or more patterns does not give a complete software architecture. Further refinement is needed. Free Advice The best architectures are full of patterns References Paul Monday, Web Patterns: Java Edition, APress, 2003 Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns: Elements of Reusable Object-Oriented Software, Addison- Wesley, 1994 Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, Patterns-Oriented Software Architecture, Vol. 1: A System of Patterns, John Wiley, 1996 Martin Fowler, Patterns of Enterprise Application Architecture, Addison-Wesley, 2003 Gregor Hohpe, Bobby Woolf, Enterprise Integration Patterns, Addison Wesley, 2004 Do not use too many unnecessary patterns (this is an anti-pattern)