Architecture Styles

From Suhrid.net Wiki
Jump to navigationJump to search

Intro

  • It is a pattern of component types and their interactions.
  • Define constraints: how things are allowed to interact.
  • Architectural pattern is synonym for style.
  • Architectural patterns package tactics. A pattern that supports availability will use redundancy as a tactic.
  • Defining features:
    • Component types: e.g data store, processes etc.
    • Component layout: e.g. which process is allowed to access data store.
    • Connectors: e.g how are they connected ? RPC, Data stream ?
    • Constraints: On components - e.g. data store cant modify itself, On connections - no P2P communication allowed.

Data Centred

  • Characterised by the access/update of a central data store.
  • The data store can be passive (e.g. a file) or be active (e.g. blackboard)
  • Good for integration and extensibility. There is a low coupling - only the data is shared.
  • E.g. Transactional DB, Blackboard, CASE Tools.

Blackboard

  • If the current state of the central data is the main trigger for processes to execute, then the repository can be a blackboard.
  • A common knowledge base, the "blackboard", is iteratively updated by a diverse group of specialist knowledge sources, starting with a problem specification and ending with a solution.
  • Each knowledge source updates the blackboard with a partial solution when its internal constraints match the blackboard state.
  • In this way, the specialists work together to solve the problem.
  • Invocation of a KS is triggered by the state of the blackboard.

Data Flow Architectures

  • Characterized by viewing the system as a series of transformations on successive pieces of input data.
  • Orderly motion of data. Explicit pattern of data flow.
  • No direct interactions b/w components.
  • Objectives: Modifiability - plug in/out components. Reusability - sequence of components plugged together.

Batch Sequential

  • Processing steps are independent programs.
  • Each step runs to completion before next step can start.
  • Batch of data is transmitted as a whole between components.

Pipe and Filter

  • Similar to batch sequential, except that the computations (filters) work incrementally on the data.
  • Data is immediately passed - i.e. it is streamed and not batched.
  • No state is retained between computations.
  • Pipes carry data from output of one computation (filter) to another.
  • e.g. Unix Shell - ls | grep "java" | wc -l
  • Advantages:
    • Simple, easy to reuse - a pipe and filter system can be made into another filter.
    • Support concurrency.
  • Disadvantages:
    • Filters operate as a separate process (process overhead). They cannot cooperate.
    • Lowest common denominator of data has to be used for data stream - e.g. ASCII text.

Virtual Machine Architecture

  • Main goal is to achieve portability.
  • A virtual machine is a software style that simulates/provides interface to functionality of underlying hardware/software platform.
  • biggest e.g JVM.
  • Running program through an interpreter adds flexibility through the ability to interrupt and query program and introduce changes at runtime. But there is a performance penalty.
  • Virtual machine structure. The interpreter selects an instruction, updates its internal state and based on instruction potentially updates the program's data.

VMInterpreter.png

Call and Return Architecture

  • Classic programming structure. Decompose program into smaller structures.
  • Goals of achieving modifiability and scalability.
  • Many different styles:
    • Main program and subroutine
    • RPC

OO Style

  • Encapsulate data and operations together.
  • Encapsulation, Polymorphism and Inheritance.

Layered Style

  • Components are assigned to layers to control component interaction.
  • Each level communicates with only its immediate neighbours, Layer N can use services of only layer N-1 and delegates subtasks to it.
  • Goal is to achieve qualities of modifiability and portability.
  • There can be a relaxed layer - where a layer talks to layers other than immediate neighbours.
  • Most common e.g. is the OSI protocol stack.
  • Advantage
    • Increased levels of abstraction.
    • Confinement of change - change can max affect to other layers.
  • Disadvantage:
    • Difficult to structure systems in layers.
    • Performance may require closer coupling between higher layers and lower layers.

Independent Component Architectures

  • Consist of a no of independent comp's which that communicate through messages.
  • Messages may be passed to named participants, or unnamed participants.
  • Goal of modifiability by decoupling various portions of computations.

Event Systems

  • Components announce data they wish to share (publish) with their environment - a set of unnamed components.
  • Other components may register an interest in the class (subscribe).
  • Typically a message manager manages communication - providing the decoupling between the publisher and the subscriber.

Communicating Processes

  • Processes communicate directly.
  • Single machine - signals.
  • Multiple machines - RPC. TCP etc.
  • classic e.g. client server architecture. Server works synchronously or asynchronously (meaning client has his own thread of control).

Heterogeneous Styles

  • Systems are rarely built from a single style.
  • Types of heterogeneity:
    • Locational: Runtime structure reveal patterns of different styles in different areas. Different style for different sub systems. e.g. one of the modules in call and return will have a shared data repository.
    • Hierarchical: A component is part of one style. When comp is decomposed, it is structured according to a different style. For e.g. a component in a pub-sub system might be layered.
    • Simultaneous: Any of several styles can be applicable.

Safety and Reliability Patterns

Homogeneous Redundancy

  • Uses identical channels to increase reliability.
  • All redundant channels are run in parallel and the output is compared.
  • If odd no of channels are used, majority-wins policy can be used that can detect and correct failures in the minority channels.
  • Advantage: reliability without additional development costs - since channels can be cloned.
  • Disadvantage: Can detect random faults, not errors (which are systematic faults).
  • Therefore protects against hardware failures.

HRedundancy.png

Monitor Actuator

  • Special type of redundancy.
  • Channels are separated into monitoring and actuator channels.
  • The actuator channel performs the action e.g. starting the motor, lowering the wing flap.
  • The monitor channel keeps track of what the actuation and monitors the environment to ensure that the results of the actuator are appropriate.
  • The actuator itself cannot rely on the monitor - they must use separate sensors.

MonitorActuator.png

Watchdog

  • A watchdog is a subsystem that receives messages from other subsystems on a periodic or sequential basis.
  • If msg arrives too late or out of sequence, watchdog takes corrective action.
  • Watchdogs usually simple - implemented in hardware. Software also possible.
  • Primary disadvantage - too simple to support complex error handling and fault recovery.

Watchdog.png

Safety Executive

  • Uses a centralized coordinator for safety monitoring and control of system from faults.
  • Advanced watchdog which tracks and coordinates all safety monitoring.
    • Watchdog timeouts.
    • Faults identified by monitors.
    • Periodic built in test suites.
    • Software error assertions.
  • For larger and complex systems, safety executive provides a centralized point for safety processing.
  • Makes it simpler to verify and validate safety measures.

SafetyExecutive.png