Professional Documents
Culture Documents
Self-Adaptive Systems ∗
Somayeh Malakuti
Software Technology Group
Technische Universität Dresden, Germany
somayeh.malakuti@tu-dresden.de
CPU_frequency_change[s_id]?
CPU_on[s_id]?
cpu_frequency = new_cpu_frequency
On
Changing
CPU_off[s_id]?
cpu_frequency = 0
CPU_on[s_id]? Off
cpu_frequency = new_cpu_frequency
BW_changed[s_id]!
NIC_on[s_id]? BW_change[s_id]?
bw = new_bw
On
Changing
NIC_off[s_id]?
bw = 0
Figure 2: The set of UPPAAL variables
NIC_on[s_id]?
bw = new_bw Off
3.1 Modeling the execution environment
There may be emergent interference among multiple SAS’s Figure 5: A model of network interface cards
because they are operating in one common environment, and
may utilize and influence a common set of resources. There-
fore, as an initial step, we model the environment in which 3.2 Modeling SAS’s
SAS’s will be executed as well as the possible changes that Separate models must be provided for each SAS to repre-
are supported by the environment. sent the fact that the SAS’s are developed separately. Fig-
For our example, we assume that there are two servers; ure 6 represents a model of for the application-level SAS.
one supports the CPU frequency of 2GHz and the network Here, a request to transcode a video on the current server
bandwidth of 100MB/s, the other supports the CPU fre- is received via the channel receive request[current server]?,
quency of 1GHz and the network bandwidth of 10MB/s. and the information about the request is updated in the
Figure 3 represents the model of servers as a parametric variable request.
template in UPPAAL; s id is the model parameter, which The current CPU frequency and network bandwidth of
represents the unique identifier of a sever. In the location current server are stored in the variables cur cpu and cur bw
Start, the requests to turn on a server are received via the to be used for selecting the best configuration of the applica-
channel synchronization turn on[s id]?. If the server is al- tion that can be executed in the current setting. If there is
ready on, on == 1, the request will be ignored. Otherwise, no such a configuration, graceful degradation is performed,
a transition takes place to the location Turning On. This is in which the implementation that requires least amount of
followed by a request to turn on the corresponding CPU via resources is selected. We assume that this implementation
the channel CPU on[s id]!. The desired value for the CPU requires the minimum CPU frequency of 1 GHz and network
frequency is determined by the function getFrequency. bandwidth of 10 MB/s, where the other implementations re-
Likewise, there will be a request to turn on the network quire the minimum CPU frequency of 2 GHz and network
card via the channel synchronization NIC on[s id]!. After- bandwidth of 100 MB/s.
wards, there will be a transition to the location Turned on, After selecting and applying the selected configuration,
in which it is informed that the server is successfully turned the request is being served by the application in the location
on via the channel synchronization turned on[s id]!. The re- Serving Request. A time-consuming computation for serving
quests to turning off a server are modeled in a similar way. the request is modeled via the invariant clk <= 30 over
turned_on[s_id]!
Turned_On
on = 1
NIC_on[s_id]!
new_bw = getBandwidth(s_id)
CPU_on[s_id]!
turn_on[s_id]? new_cpu_frequency = getFrequency(s_id)
turn_on[s_id]? on == 0 Turning_On
on == 1
on == 0 turn_off[s_id]? CPU_off[s_id]! NIC_off[s_id]!
on == 1
Start Turned_Off
Turning_Off
turn_off[s_id]?
turned_off[s_id]!
on = 0
Start
receive_request[current_server]?
request = getRequestInfo()
request != VALIDREQUEST
request == VALIDREQUEST
cur_cpu = getCurrentCPU(),
cur_bw = getCurrentBW(),
clk = 0
Finding_Configuration
clk <= 20
config = getConfig(),
clk = 0
config == -1 config != -1
req_cpu_frequency = 1, req_cpu_frequency = 2,
Gracefully_Degrade req_bw = 10 req_bw = 100 Applying_Configuration
clk <= 10 clk <= 20
Configuration_Ready
clk = 0
Serving_Request
request_served[current_server]! clk <= 30
the clock variable clk. When the request is served, it is 3.4 Verifying SAS’s
announced via request served[current server]!. To ensure that each SAS has a correct behavior when ex-
Figure 7 represents a model of the VM-level SAS. As soon ecuted individually, we define the following set of properties
as the VM-level SAS starts executing, it constantly checks for each SAS and verify them on the corresponding models.
the load of current server, to detect whether the server is
underutilized. If the load is below MINLOAD, it finds a E<> (ApplicationLevelSAS.request == VALID REQUEST
new server, and starts migrating the VMs to the new server. and ApplicationLevelSAS.Serving Request)
Afterwards, it turns off the current server.
(1)
The property 1 specifies that if there is a valid request from
3.3 Modeling the runtime scenarios user, the request will eventually be served by the application.
To be able to simulate and/or verify the behavior of SAS’s,
we require to model the actual usage scenarios for the SAS’s.
A[] not (ApplicationLevelSAS.Applying Configuration and
Figure 8 represents an example model that we provide for
(CPU(current server).cpu frequency < cur cpu
our illustrative example. or NIC(current server).bw < cur bw))
Here, two servers are turned on, and the request to start
(2)
the VM-level SAS is issued via start!. Afterwards, five re-
quests are issued to the application-level SAS, which are The safety property 2 specifies that it will never be the case
served sequentially. These requests are modeled via the that while configuring the application with a new implemen-
channel synchronizations receive request[current server]! re- tation, the CPU frequency and network bandwidth goes be-
quest served[current server]?. low the amount being used for selecting the implementation.
!(load >0 && load <= MINLOAD)
Checking_Load
load > 0 && load <= MINLOAD
turned_off[tmp]?
Finding_Server
new_server = getNewServer()
new_server != current_server
turn_off[tmp]!
Start_Migrating
tmp = current_server,
End_Migrating current_server = new_server
new_server == current_server
new_cpu_frequency = 2, new_cpu_frequency = 1,
new_bw = 100 new_bw = 10
start!
current_server = 1
receive_request[current_server]!
cnt >= 5
cnt ++ cnt < 5
request_served[current_server]?
If this property is violated, the selected implementation is timed automata with each other. The specification of a SoS
not a valid one, because it requires more resources than what that is composed of the application-level and the VM-level
is currently available. SAS’s running in a shared server is shown below:
system
A[] not (ApplicationLevelSAS.Serving Request and CPU, NIC, Server, ApplicationLevelSAS, VMLevelSAS, Run-
(CPU(current server).cpu frequency < req cpu frequency timeScenario;
or NIC(current server).bw < req bw))