E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science.

Slides:



Advertisements
Similar presentations
DISTRIBUTED COMPUTING PARADIGMS
Advertisements

MicroKernel Pattern Presented by Sahibzada Sami ud din Kashif Khurshid.
Remote Procedure Call (RPC)
CCNA – Network Fundamentals
Broker Pattern Pattern-Oriented Software Architecture (POSA 1)
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Data Communications and Networking (Third Edition)
Slide 1 Client / Server Paradigm. Slide 2 Outline: Client / Server Paradigm Client / Server Model of Interaction Server Design Issues C/ S Points of Interaction.
Seyed Mohammad Ghaffarian ( ) Computer Engineering Department Amirkabir University of Technology Fall 2010.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
© 2007 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.1 Computer Networks and Internets with Internet Applications, 4e By Douglas.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Application Layer PART VI.
Communication in Distributed Systems –Part 2
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
What Is TCP/IP? The large collection of networking protocols and services called TCP/IP denotes far more than the combination of the two key protocols.
I NTRODUCTION OF S OCKET P ROGRAMMING L.Aseel AlTurki King Saud University.
Fundamentals of Python: From First Programs Through Data Structures
Gursharan Singh Tatla Transport Layer 16-May
Chapter 26 Client Server Interaction Communication across a computer network requires a pair of application programs to cooperate. One application on one.
CSIT 320 (Blum)1 Client-Server Interaction Based on Appendix 1 in Computer Networks and Internets, Comer.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science Washington University, St. Louis
Introduction to Ice Copyright © ZeroC, Inc. Ice Programming with Java 1. Introduction to Ice.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Pattern Oriented Software Architecture for Networked Objects Based on the book By Douglas Schmidt Michael Stal Hans Roehnert Frank Buschmann.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
SAMANVITHA RAMAYANAM 18 TH FEBRUARY 2010 CPE 691 LAYERED APPLICATION.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 09. Review Introduction to architectural styles Distributed architectures – Client Server Architecture – Multi-tier.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.
Track 1: Summary Slides for POSA2 Patterns and Frameworks Distributed Real-Time Systems (TI-DRTS) Version:
DISTRIBUTED COMPUTING PARADIGMS. Paradigm? A MODEL 2for notes
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Guandong Wang, Zhenning Hu, Zhenghui Xie Department of.
Proactor Pattern Venkita Subramonian & Christopher Gill
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Chapter 2 Applications and Layered Architectures Sockets.
Client Call Back Client Call Back is useful for multiple clients to keep up to date about changes on the server Example: One auction server and several.
DISTRIBUTED SYSTEMS Principles and Paradigms Second Edition ANDREW S
Architectural pattern: Interceptor Source: POSA II pp 109 – 140POSA II Environment: developing frameworks that can be extended transparently Recurring.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Chris Gill Department of Computer Science and Engineering Washington University, St. Louis
Threaded Programming in Python Adapted from Fundamentals of Python: From First Programs Through Data Structures CPE 401 / 601 Computer Network Systems.
Interfaces and Services Each layer provides a service to the layer above it. A service is a set of primitive operations. Under UNIX, primitives are implemented.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Architectural pattern: Reactor Source: POSA II pp 179 – 214POSA II Environment: an application that receives multiple requests simultaneously but may process.
1 Client-Server Interaction. 2 Functionality Transport layer and layers below –Basic communication –Reliability Application layer –Abstractions Files.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Developing Adaptable Software Architectures for Real-Time Systems Using Design Patterns Lawrence Chung, Kendra Cooper, Anna Yi The University of Texas.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Interceptor CS562 Spring 2002 Jan Anand Krishnan Morgan Deters Venkita Subramonian.
File Transfer And Access (FTP, TFTP, NFS). Remote File Access, Transfer and Storage Networks For different goals variety of approaches to remote file.
CSE 332: Design Patterns (Part II) Last Time: Part I, Familiar Design Patterns We’ve looked at patterns related to course material –Singleton: share a.
E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Huang-Ming Huang, Shih-Ling Chen, Sajeeva Pallemulle.
Netprog: Client/Server Issues1 Issues in Client/Server Programming Refs: Chapter 27.
1 Network Communications A Brief Introduction. 2 Network Communications.
SPL/2010 Reactor Design Pattern 1. SPL/2010 Overview ● blocking sockets - impact on server scalability. ● non-blocking IO in Java - java.niopackage ●
Client-server communication Prof. Wenwen Li School of Geographical Sciences and Urban Planning 5644 Coor Hall
1 K. Salah Application Layer Module K. Salah Network layer duties.
Process-to-Process Delivery:
High degree of user interaction Interactive Systems: Model View Controller Presentation-abstraction-control.
Threaded Programming in Python
Event Handling Patterns Asynchronous Completion Token
Chapter 3 Internet Applications and Network Programming
Principles of Network Applications
Client-Server Interaction
Chapter 3: Windows7 Part 4.
Inter Process Communication (IPC)
Half-Sync/Half-Async (HSHA) and Leader/Followers (LF) Patterns
Starting TCP Connection – A High Level View
Monitor Object Pattern
SAMANVITHA RAMAYANAM 18TH FEBRUARY 2010 CPE 691
Threaded Programming in Python
Presentation transcript:

E81 CSE 532S: Advanced Multi-Paradigm Software Development Venkita Subramonian, Christopher Gill, Ying Huang, Marc Sentany Department of Computer Science and Engineering Washington University, St. Louis Acceptor/Connector Pattern

Context Networked system or application –I.e., communication between remote hosts Connection-oriented protocols –E.g., TCP/IP Peer services –I.e., client and server roles Connected via endpoints –E.g., IP ports Endpoints are distinct from connections – vs, >

Client and Server Roles Each process plays a single role –E.g., Logging Server example –Logging Server gets info from several clients Roles affect connection establishment as well as use –Clients actively initiate connection requests –Server passively accepts connection requests Client/server roles may overlap –Allow flexibility to act as either one –Or, to act as both at once (e.g., in a publish/subscribe gateway) Server Client Server/Client Listening port

Problem Flexibility, performance can be lost if we tightly couple –Connection establishment –Protocol-specific details –Service handler instantiation and initialization –Application logic for service processing Need to resolve four key design forces –Changing connection roles to vary application behavior –Adding new services, implementations, and protocols –Connection establishment/initialization vs. protocols/services Protocols and services more likely to be changed or enhanced Should not be tightly coupled with connection management –Reduce connection (re-)establishment latency Via advanced OS features and new protocols (e.g., SCTP)

Solution – (further) separation of concerns Dispatcher Event sources Event de-multiplexing & dispatching Acceptor Connector Connection establishment, service instantiation & initialization Service handling (connection use) Handler

Solution Approach Decouple two consecutive phases of activity –Connection establishment and initialization –Service processing Decouple three main roles –Passively accept connection requests Acceptor role –Actively initiate connection requests Connector role –Perform service-specific processing using the connection Service Handler role Also decouple three supporting roles –Dispatcher (e.g., Reactor or Proactor), Endpoint, Handle

Solution Approach, Continued Application services –Encapsulated within peer Service Handlers Two factories: Acceptor and Connector –Connect and initialize peer service handlers –May also allocate and construct service handlers –Pass handlers their respective Transport Handles Separation of phases –Service handlers may not need to interact with acceptor-connector after connection/initialization –Unless handlers take on connector/acceptor roles

Solution Approach, Continued Acceptor behaves as a server-side factory –Listens on a known endpoint –Connection request events arrive –Acceptor accepts new connection, gets new endpoint handle –May create new service handler (or be given one to use) –Gives new endpoint handle to the service handler –Usually invokes the service handler’s activation method Connector behaves as a client-side factory –Makes connection requests actively –Contacts remote acceptor at well-known endpoint –May create new service handler (or be given one to use) –Gives new endpoint handle to the handler –May invoke the service handler’s activation method

Solution Structure Overview Transport Endpoint –E.g., address:port –Allows Service Handlers to exchange requests/data over a network Transport Handle –E.g., socket handle –Hides details of the Transport Endpoint Service Handler –Implements half of an end-to-end service in a networked application Acceptor –Passively accepts connection requests on a known Transport Endpoint –Connects and initializes server-side Service Handlers Connector –Actively connects and initializes client-side Service Handlers Dispatcher –Registers and dispatches Acceptors, Connectors, and Service Handlers –Dispatches events for connection requests, service processing

Structure Diagram From POSA2

Acceptor/Connector Implementation De-multiplexing and dispatching infrastructure –Handles events that occur on transport endpoints –Consists of transport and dispatching mechanisms Implementation can be subdivided –Transport mechanisms Components often provided by the underlying OS platform Can be accessed via Wrapper Façade facades –Dispatching mechanisms Dispatcher and event handler components E.g., Reactor or Proactor Can also be implemented using a separate thread per connection

Implementation, Continued Connection management –Creates service handlers –Passively or actively connects service handlers to remote peer service handlers –Activates service handlers after they are connected –All interfaces should be abstract/generic –Offer implementations these interfaces I.e., concrete general-purpose acceptors and connectors –Define generic acceptor and connector bridges define interface: polymorphism vs. parameterized types implement generic/abstract methods

Implementation, Continued Application –Defines concrete service handlers Define application’s end-to-end services Can also define service concurrency strategies –May customize concrete acceptors and connectors E.g., as factories to create application-specific handlers E.g., to provide customized IPC mechanisms –Components instantiate generic/abstract service handler, acceptor, and connector interfaces

Acceptor Initialization When Acceptor initialization method is called –E.g., through a call to its open() method – Acceptor binds to a transport endpoint Specified by a given address for that transport E.g., a TCP/IP address and port Often useful to run acceptor reactively –I.e., register the acceptor as “yet another handler” with a reactor –Reactor will call the acceptor when a connection request event arrives on its endpoint

Dynamics: Acceptor Scenario Passive Connection Establishment –Passive-mode transport endpoint initialization –Acceptor’s connection initialization method is called Sets up the transport endpoint, binds it to a transport address Acceptor listens on this endpoint for connection requests Acceptor registers itself with dispatcher

Dynamics: Acceptor Scenario Service handler initialization –Dispatcher notifies acceptor when connection request arrives –Acceptor creates a new connected transport endpoint, encapsulates it via a transport handle –Acceptor creates a new service handler Gives the transport handle to the service handler Calls the handler’s initiation hook method The hook method performs specific handler initialization Service processing –Service handlers exchange data through connected transport endpoints –When all exchanges are complete, service handlers shut down All handles and endpoints are shut down and resources released Why is this step important?

Acceptor Scenario Interactions From POSA2

Synch/Asynch Connector Behavior Useful to allow connection initiation to be either synchronous or asynchronous –Separate the connector’s connection initiation method from its completion method Synchronous connection establishment –Connector blocks until transport endpoints are connected –Connector calls Service Handler’s activation hook directly –Reasonable alternative if Connection establishment latency is very low It is possible and efficient to use a thread-per-connection model Services must be initialized in a fixed order Clients cannot do useful work until multiple connections have been established

Asynchronous Connection Establishment Connector initiation method returns once request sent Service handler is activated by connection completion method (e.g., by registering it with a reactor) Dispatcher notifies connector when transport endpoint is ready Beneficial if –Establishing connections over high latency links –Using multiple connections per thread –Initializing many peers that can be connected in an arbitrary order –Clients can make progress by using connections independently

Dynamics: Connector Scenario I Active Synchronous Connection Establishment Connection initiation –Connector’s initiation method will block the applications thread –Until connection establishment completes synchronously

Dynamics: Connector Scenario I Service handler initialization –After completion, service handler’s open hook method is called directly –Open method performs handler-specific initialization E.g., registers itself with the Dispatcher Service processing –Mediated by Dispatcher upcalls to service handler hook method –E.g., handle_event ()

Connector Scenario I Interactions From POSA2

Dynamics: Connector Scenario II Active Asynchronous Connection Establishment Connection initiation –Invoke connector initiation method as in Scenario I –Connector registers itself, transport handle with the dispatcher –Thus application thread does not block –Connector receives connection completion notification from dispatcher

Dynamics: Connector Scenario II, Continued Service handler initialization –Connector’s connection completion hook method is called –Cleans up resources allocated for connection establishment –Calls the service handler’s open hook method –Service handler’s open method performs specific handler initialization E.g., registers itself with Dispatcher Service processing –Dispatcher calls service handler’s processing hook method E.g., handle_event ()

Connector Scenario II Interactions From POSA2