Distributed System Patterns
Distributed System Patterns
Distributed System
Patterns
Phillip J. Windley, Ph.D.
CS462 – Large-Scale Distributed Systems
Lesson 02: Distributed System Patterns
Contents
00 Coupling
03 Distributed Architectures
01 04
Distributed System Design Axes Conclusion
02 Rethinking Distributed
Coupling One of the most important
properties of a distributed
system is how tightly or
loosely coupled the
processing is.
Lesson 02: Distributed System Patterns
Coupling
Generally when designing If two processes are completely independent they can successfully
operate without any kind of coordination with the other process.
distributed systems
Whenever we introduce dependencies, the processes must
anything that makes the coordinate their activities. This requires some kind of
system more loosely communication between the two processes. This can result in
coupled is desirable. wasted computation, delays due to latency, and computational
errors.
But, no useful software Of course, we can’t accomplish most interesting computations
without some coupling. Good distributed architectures accomplish
system can be built where their tasks with a minimum of coupling. Good distributed system
all the components are architects choose architectures that minimize the coupling
necessary to get the job done.
completely decoupled.
In Event-Based Logical coupling occurs when two processes share information or
make assumptions about the other. When this happens, one
Programming, Ted Faison process can have an effect on the other even when they share no
identifies three flavors of data.
coupling: logical, type, and For example, suppose both processes share an algorithm for
signature. calculating sales tax. Changes to one process will affect the other
despite the fact that there is no computational artifact (code, API,
etc.) that links them. This can occur even if one makes assumptions
about how the other computes sales tax.
Logical coupling can be and should be avoided because it adds
nothing to the computation and is a potential source of logical
errors and system failure.
Type coupling occurs when Type coupling is one of the most common forms of coupling in
distributed systems. External interfaces abound and distributed
one process references systems use those interfaces to make requests of and give
the external interface or commands to other processes.
(worse) internal model of External interfaces, called APIs, provide a contract that defines the
another. interprocess communication. Coupling occurs because the calling
process has to know the syntax and semantics of the API and is
thus dependent on it.
Another, more insidious, form of type coupling occurs when
processes share a data model. For example two processes may
have direct access to a database and used it as a shared memory,
linking them. Shared memory requires careful and complex
coordination and is often a source of logical coupling through
share semantics.
Signature coupling occurs For distributed systems, the primary difference between type and
signature coupling is that the latter refers to run-time
when one process
considerations. For example, a service you depend on may be
indirectly and dynamically down or non-performant.
causes another process to Messaging interfaces are also a form of signature coupling since
take action.* they are more dynamic than request-response or RPC-style
interfaces. Messages don’t require the same level of interface
dependency as an API.
In general, signature coupling is preferable to type coupling since
two processes coupled by messaging know much less about the
internal semantics and capabilities of the other. Dynamic
* Faison defines signature coupling relative interaction also allows for programmatic self-healing of faults, a
to object-oriented programming. I’ve recast it desirable property of distributed systems.
in light of more general-purpose distributed
system concepts.
Distributed systems are We saw in Why Distributed Systems?[01] that a distributed system
is one made up of a number of processes that are coordinating
made from two or more their efforts to achieve a specific goal or offer a specific service.
processes that are The key principle is that even though multiple processes are being
interconnected to achieve used, to the end user of the computation, it appears that a single
a specific purpose. computer were being used.
Achieving this requires careful design. There are myriad design
Design involves choosing choices a distributed system architect can follow in achieving
precise system goals.
the process architecture,
their interconnections,
and controlling data.
Distributed
Lesson 02: Distributed System Patterns
Introducing Heterarchy
Hierarchy is a familiar Hierarchy is an arrangement of items where any given item can
be above or below others. Hierarchy depends on ranking and
word that is used invokes concepts such as superior, inferior, subordinate, order,
frequently to describe rank, and level.
different kinds of In contrast, a heterarchy is an arrangement where items are not
organization. ranked and all, theoretically, play an equal role—they are peers.
Peers in a heterarchy may be related and connected to each
other in different ways.
Heterarchy refers to a
Most interesting systems, like social and biological systems, are
related, familiar concept, mixtures of hierarchy and heterarchy. For example, cities are
even if it is an unfamiliar largely heterarchical in organization, but contain many
hierarchical structures, including the city government,
word. businesses, and families.
Heterarchical Computing
Patterns
impact on performance,
reliability, and scalability.
Lesson 02: Distributed System Patterns
Client-Server
Multi-Tiered Architecture
Horizontal Scaling
Peer to Peer
This lesson has looked at several important The word distributed is used as a catchall for
concepts that will guide us in our explorations. systems that are decentralized, heterarchical, or
Coupling is at the heart of what makes merely distributed. Yet these terms mean very
distributed systems hard to build and tricky to different things. We can design systems that
operate. No useful system can avoid it, but we have any or all of these properties.
can reduce it. In doing so there are numerous interconnection
There are multiple design axes that affect the patterns we can choose from. This choice has
behavior, performance, scalability, and cost of a significant impact on the operation of our
distributed system. We will use these as we system. Consequently, we’ll review each of the
design distributed systems. architectural patterns (except for the multi-tier
model) in detail in coming lessons.
Credits