Glossary Flashcards
Asynchronous
The Oxford Dictionary defines asynchronous as “not existing or occurring at the same time”.
In the context of the Reactive Manifesto we mean that the Processing of a Request Occurs at an arbitrary point in time, sometime after it has been transmitted from Client to Service.
The Client cannot directly Observe, or Synchronize with, the Execution that occurs within the Service.
This is the Antonym of Synchronous Processing which implies that the client only resumes its own execution once the service has processed the Request.
Back-Pressure
Back-pressure is an important feedback mechanism that allows Systems to gracefully respond to Load rather than collapse under it.
When one component is struggling to keep-up, the System as a whole needs to respond in a sensible way.
It is unacceptable for the Component under stress to Fail catastrophically or to Drop Messages in an uncontrolled fashion.
Since it can’t cope and it can’t fail it should Communicate the fact that it is under stress to Upstream Components and so get them to reduce the load.
The Back-pressure may cascade all the way up to the user, at which point Responsiveness may degrade, but this Mechanism will ensure that the System is Resilient under load, and will provide information that may allow the System itself to apply other resources to help distribute the Load, see Elasticity.
Batching
Batching provides the opportunity to share out the cost of expensive operations such as I/O or expensive computations. For example, packing multiple data items into the same network packet or disk block to increase efficiency and reduce utilization.
Current computers are Optimized for the Repeated Execution of the same Task: instruction caches and branch prediction increase the number of instructions that can be processed per second while keeping the clock frequency unchanged. This means that giving different tasks to the same CPU core in rapid succession will not benefit from the full performance that could otherwise be achieved: if possible we should structure the program such that its execution alternates less frequently between different tasks. This can mean processing a set of data elements in batches, or it can mean performing different processing steps on dedicated hardware threads.
The same reasoning applies to the use of external resources that need synchronization and coordination. The I/O bandwidth offered by persistent storage devices can improve dramatically when issuing commands from a single thread (and thereby CPU core) instead of contending for bandwidth from all cores. Using a single entry point has the added advantage that operations can be reordered to better suit the optimal access patterns of the device (current storage devices perform better for linear than random access)
Component
the term “Component” is being used due to its proximity with Compartment
implies that each Component is Self-Contained, Encapsulated and Isolated from other Components.
Component can be used to describe a Module in Software Architecture
Component can be used to describe a Bounded Context in DDD.
Component can be used to describe a Module in the Source Code.
This notion applies foremost to the runtime characteristics of the System,
but it will typically also be reflected in the Source Code’s Module Structure as well.
More:
- Different Components might make use of the same Software Modules to perform Common Tasks, the Program Code that defines the Top-Level Behavior of each Component is then a Module of its own.
- Component Boundaries are often closely aligned with Bounded Contexts in the Problem Domain. the System Design tends to reflect the Problem Domain and so is easy to evolve, while retaining Isolation.
- Message protocols provide a Natural Mapping and Communications Layer between Bounded Contexts (Components).
Delegation
Delegating a Task Asynchronously to another Component means that the execution of the Task will take place in the Context of that other Component.
This Delegated Context could entail running in a different error handling Context, on a different Thread, in a different Process, or on a different Network Node, to name a few possibilities.
The purpose of delegation is to hand over the processing responsibility of a Task to another Component so that the Delegating Component can perform other processing or optionally observe the progress of the Delegated Task in case Additional Action is required such as handling failure or reporting progress.
Elasticity (in contrast to Scalability)
Elasticity means that the throughput of a System Scales up or down automatically to meet varying demand as resource is proportionally added or removed.
The System needs to be Scalable to allow it to benefit from the Dynamic Addition, or Removal, of Resources at Runtime.
Elasticity therefore builds upon Scalability and expands on it by adding the notion of Automatic Resource Management.
Failure (in contrast to Error)
A Failure is an Unexpected Event
An Error is an Expected and Coded condition
A Failure is an Unexpected Event within a Service that prevents it from continuing to function normally.
A Failure will generally prevent responses to the current, and possibly all following, client requests.
This is in contrast with an Error, which is an Expected and Coded-For Condition—for example an error discovered during input validation, that will be communicated to the client as part of the normal processing of the message.
Failures are unexpected and will require intervention before the system can resume at the same level of operation. This does not mean that failures are always fatal, rather that some capacity of the system will be reduced following a Failure. Errors are an expected part of normal operations, are dealt with immediately and the system will continue to operate at the same capacity following an error.
Examples of failures are hardware malfunction, processes terminating due to fatal resource exhaustion, program defects that result in corrupted internal state.
Isolation (and Containment)
Isolation can be defined in terms of decoupling, both in time and space. Decoupling in time means that the sender and receiver can have independent life-cycles—they do not need to be present at the same time for communication to be possible. It is enabled by adding asynchronous boundaries between the components, communicating through message-passing. Decoupling in space (defined as Location Transparency) means that the sender and receiver do not have to run in the same process, but wherever the operations division or the runtime itself decides is most efficient—which might change during an application’s lifetime.
True isolation goes beyond the notion of encapsulation found in most object-oriented languages and gives us compartmentalization and containment of:
State and behavior: it enables share-nothing designs and minimizes contention and coherence cost (as defined in the Universal Scalability Law);
Failures: it allows failures to be captured, signalled and managed at a fine-grained level instead of letting them cascade to other components.
Strong isolation between components is built on communication over well-defined protocols and enables loose coupling, leading to systems that are easier to understand, extend, test and evolve.
Location Transparency
Elastic systems need to be adaptive and continuously react to changes in demand, they need to gracefully and efficiently increase and decrease scale. One key insight that simplifies this problem immensely is to realize that we are all doing distributed computing. This is true whether we are running our systems on a single node (with multiple independent CPUs communicating over the QPI link) or on a cluster of nodes (with independent machines communicating over the network). Embracing this fact means that there is no conceptual difference between scaling vertically on multicore or horizontally on the cluster.
If all of our components support mobility, and local communication is just an optimization, then we do not have to define a static system topology and deployment model upfront. We can leave this decision to the operations personnel and the runtime, which can adapt and optimize the system depending on how it is used.
This decoupling in space (see the the definition for Isolation), enabled through asynchronous message-passing, and decoupling of the runtime instances from their references is what we call Location Transparency. Location Transparency is often mistaken for ‘transparent distributed computing’, while it is actually the opposite: we embrace the network and all its constraints—like partial failure, network splits, dropped messages, and its asynchronous and message-based nature—by making them first class in the programming model, instead of trying to emulate in-process method dispatch on the network (ala RPC, XA etc.). Our view of Location Transparency is in perfect agreement with A Note On Distributed Computing by Waldo et al.
Message-Driven (in contrast to Event-Driven)
A Message is an Item of Data that is sent to a Specific Destination.
An Event is a signal emitted by a Component upon reaching a given State.
In a Message-Driven System addressable recipients await the arrival of Messages and React to them, otherwise lying dormant.
In an Event-Driven System notification listeners are attached to the Sources of Events such that they are invoked when the event is emitted.
This means that an Event-Driven System focuses on addressable Event Sources while a Message-Driven System concentrates on addressable recipients.
A message can CONTAIN an encoded event as its payload.
Resilience is more difficult to achieve in an Event-Driven System due to the short-lived nature of Event consumption chains:
when processing is set in motion and listeners are attached in order to React to and Transform the Result, these Listeners typically handle Success or Failure Directly and in the sense of reporting back to the original client. Responding to the failure of a Component in order to restore its proper function, on the other hand, requires a treatment of these failures that is not tied to ephemeral client requests, but that responds to the overall component health state.
Non-Blocking
In concurrent programming an algorithm is considered non-blocking if threads competing for a resource do not have their execution indefinitely postponed by mutual exclusion protecting that resource. In practice this usually manifests as an API that allows access to the resource if it is available otherwise it immediately returns informing the caller that the resource is not currently available or that the operation has been initiated and not yet completed. A non-blocking API to a resource allows the caller the option to do other work rather than be blocked waiting on the resource to become available. This may be complemented by allowing the client of the resource to register for getting notified when the resource is available or the operation has completed.
Protocol
A protocol defines the treatment and etiquette for the exchange or transmission of messages between components. Protocols are formulated as relations between the participants to the exchange, the accumulated state of the protocol and the allowed set of messages to be sent. This means that a protocol describes which messages a participant may send to another participant at any given point in time. Protocols can be classified by the shape of the exchange, some common classes are request–reply, repeated request–reply (as in HTTP), publish–subscribe, and stream (both push and pull).
In comparison to local programming interfaces a protocol is more generic since it can include more than two participants and it foresees a progression of the state of the message exchange; an interface only specifies one interaction at a time between the caller and the receiver.
It should be noted that a protocol as defined here just specifies which messages may be sent, but not how they are sent: encoding, decoding (i.e. codecs), and transport mechanisms are implementation details that are transparent to the components’ use of the protocol.
Replication
Executing a component simultaneously in different places is referred to as replication. This can mean executing on different threads or thread pools, processes, network nodes, or computing centers. Replication offers scalability, where the incoming workload is distributed across multiple instances of a component, or resilience, where the incoming workload is replicated to multiple instances which process the same requests in parallel. These approaches can be mixed, for example by ensuring that all transactions pertaining to a certain user of the component will be executed by two instances while the total number of instances varies with the incoming load, (see Elasticity).
Resource
Everything that a Component relies upon to perform its function is a Resource that must be Provisioned according to the Component’s needs.
This includes:
CPU allocation, Main Memory and Persistent Storage as well as Network Bandwidth,
Main Memory Bandwidth, CPU caches, inter-socket CPU links, reliable Timer and Task scheduling services,
other input and output devices, external Services like Databases or Network File Systems etc.
The elasticity and resilience of all these resources must be considered, since the lack of a required Resource will prevent the component from functioning when require
Scalability
The ability of a system to make use of more computing resources in order to increase its performance is measured by the ratio of throughput gain to resource increase. A perfectly scalable system is characterized by both numbers being proportional: a twofold allocation of resources will double the throughput. Scalability is typically limited by the introduction of bottlenecks or synchronization points within the system, leading to constrained scalability, see Amdahl’s Law and Gunther’s Universal Scalability Model.