Adaptation is modification of an organism or its parts that make it more fit for existence under the conditions of its environment. 
Adaptation techniques allow software to modify its own functions and configuration in response to changes in its execution environment. In order to incorporate an adaptable behavior, an application must have a way to monitor the execution environment and discover relevant variations that requires reconfiguration. 
The need for adaptation comes from the fact that the environment in which distributed applications are executed changes continuously. Changes include those resulting from mobility, a strong variance in the quality-of-service of networks, failing hardware, and battery drainage, amongst others. Rather than making applications responsible for reacting to changes, this task is placed in the middle ware. These strong influences from the environment have brought many designers of middle ware to consider the construction of adaptive software. 
Adaptive software, that is, software that can change its behavior at runtime has a number of potential beneﬁts, ranging from the ability to respond rapidly to security threats to the opportunity to optimize performance as characteristics of the underlying execution environment change. The value is especially pronounced in distributed systems, which are arguably more prone to the type of situations that would beneﬁt from an adaptive response. Unfortunately, implementing adaptive software is also more challenging in such systems for a variety of reasons, including the need to coordinate adaptation among multiple machines. 
The need for self-adaptation in Distributed Systems :
Ø In such environments applications and users will benefit a lot from context awareness and adaptively
o Adapt application to resource situation (battery, bandwidth, memory)
§ Example: Dynamically adapt media quality (e.g., video) to available bandwidth
o Dynamically adapt user interface to situation of user
o Adapt application to availability of devices and services in the environment (ubiquitous services)
Ø The demand for applications exhibiting such properties is accelerating
o Mobile computing
o Ubiquitous computing
o Service oriented computing
o Sensor networks
Ø Challenge for users, application and systems developers and managers
A number of issues have to be addressed to construct such adaptive software, especially software that supports graceful adaptation in a distributed system. These include: 
Ø Change detection.
Ø Adaptation policy.
Architecture: The basic software architecture on a host is shown in ﬁgure 1. 
This architecture consists of a number of system layers, which may either be adaptive or non-adaptive. Adaptive layers are constructed as a collection of adaptive components (ACs). 
A collection of adaptive components across multiple machines that cooperate to implement a speciﬁed portion of a distributed service is called a distributed adaptive component (DAC). The type of functionality provided by a DAC can vary from implementing functions such as reliability or message ordering for communication-oriented services. 
Figure 2 shows the internal structure of an AC, which consists of two different types of modules: a component adaptor module (CAM) and alternative adaptation-aware algorithm modules (AAMs). Each AAM provides a different algorithm that implements the functionality of the component, while the CAM controls the component’s adaptive behavior.
Independence between AAMs allows different modules to be developed in isolation and new modules to be added without modifying the existing ones, while independence between a CAM and AAMs allows the CAM to control any set of AAMs, including new ones that are loaded at runtime. Independence is achieved by specifying a small set of standard operations each CAM and AAM must export for adaptation.
The overall adaptation process for a DAC can be divided into three phases: change detection, agreement, and adaptive action.
Change detection: The ﬁrst phase involves detecting a change in the execution environment and determining whether it would be beneﬁcial to adapt in response to that event.
Agreement: The second phase is an agreement process in which all ACs reach consensus on, in essence, whether a change has occurred and whether an adaptive action should be taken.
Adaptive action: The ﬁnal phase implements the graceful adaptation process, i.e., it orchestrates the change from one AAM to another in such a way that the DAC continuously implements its correct functionality.
API and control ﬂow: Each AAM must provide an appropriate API for executing the three steps in the graceful adaptation protocol.
In this ﬁgure, the preparation step is implemented by Pre Activate () and Pre Deactivate (). Deactivate () is used to initiate the switchover activity, while Activate OS () and Activate IS () implement the outgoing and incoming switchover, respectively.
The architecture for building adaptive software for distributed systems is based on Cactus, which is a system for constructing highly-conﬁgurable distributed services and protocols. In Cactus, different properties and functions of a service on a given host are implemented as software modules that interact using an event-driven execution paradigm.
A service is implemented in Cactus using one composite protocol per host, with each variant of a property or functional component implemented as a micro-protocol. A micro-protocol is, in turn, structured as a collection of event handlers, which are procedure-like segments of code that are executed when a speciﬁed event occurs. Events can be raised explicitly by micro-protocols or implicitly by the Cactus runtime system.
The runtime implements basic event handling operations, and is linked with a collection of micro-protocols to form a composite protocol that implements some customized distributed service.
 Merriam-Webster. (n.d.). Adaptation. In Merriam-Webster.com dictionary. Retrieved June 7, 2021, from https://www.merriam-webster.com/dictionary/adaptation.
 B. Ensink and V. Adve, “Coordinating adaptations in distributed systems,” 24th International Conference on Distributed Computing Systems, 2004. Proceedings., 2004, pp. 446–455, doi: 10.1109/ICDCS.2004.1281611.
 Tanenbaum, A. S., & Steen, M. (2017b). Distributed Systems — Principles and Paradigms. In ARCHITECTURES (2nd ed., p. 57). Prentice Hall.
 Hiltunen, M. A., & Schlichting, R. D. (2001). Constructing Adaptive Software in Distributed Systems. AT&T Labs — Research. https://www.researchgate.net/publication/2390776_Constructing_Adaptive_Software_in_Distributed_Systems
 Eliassen, F. (2010). Adaptive Distributed Software Systems [Slides]. University of Oslo. https://www.uio.no/studier/emner/matnat/ifi/INF5360/v10/undervisningsmateriale/introAdaptiveDS.pdf