Adaptive Computation of Oading From Mobile Devices Into The Cloud
Adaptive Computation of Oading From Mobile Devices Into The Cloud
net/publication/261283944
CITATIONS READS
122 744
3 authors, including:
Some of the authors of this publication are also working on these related projects:
Special Issue on "Learning Analytics in primary, secondary and higher education" View project
All content following this page was uploaded by Ralf Klamma on 14 July 2017.
Abstract—The inherently limited processing power and battery Offloading has gained big attention in mobile cloud com-
lifetime of mobile phones hinder the possible execution of puting research, because it has similar aims as the emerging
computationally intensive applications like content-based video cloud computing paradigm, i.e. to surmount mobile devices’
analysis or 3D modeling. Offloading of computationally intensive
application parts from the mobile platform into a remote cloud shortcomings by augmenting their capabilities with external
infrastructure or nearby idle computers addresses this problem. resources. Offloading or augmented execution refers to a tech-
This paper presents our Mobile Augmentation Cloud Services nique used to overcome the limitations of mobile phones in
(MACS) middleware which enables adaptive extension of Android terms of computation, memory and battery. Such applications,
application execution from a mobile client into the cloud. Applica- which can adaptively be split and parts offloaded [4], [5],
tions are developed by using the standard Android development
pattern. The middleware does the heavy lifting of adaptive are called elastic mobile applications. Basically, this model of
application partitioning, resource monitoring and computation elastic mobile applications enable the developers the illusion
offloading. These elastic mobile applications can run as usual as if he/she is programming virtually much more powerful
mobile application, but they can also reach transparently re- mobile devices than the actual capacities. Moreover, elastic
mote computing resources. Two prototype applications using the mobile application can run as stand-alone mobile application
MACS middleware demonstrate the benefits of the approach. The
evaluation shows that applications, which involve complicated but also use external resources adaptively. Which portions of
algorithms and large computations, can benefit from offloading the application are executed remotely is decided at runtime
with around 95% energy savings and significant performance based on resource availability. In contrast, client/server appli-
gains compared to local execution only. cations have static partitioning of code, data and business logic
between the server and client, which is done in development
I. I NTRODUCTION phase.
Our contributions include an integration with the estab-
Resource-demanding multimedia applications such as 3D lished Android application model for development of “offload-
video games are being increasingly demanded on mobile able” applications, a lightweight application partitioning and
phones. Even if mobile devices’ hardware and mobile net- a mechanism for seamless adaptive computation offloading.
works continue to evolve and to improve, mobile devices will We propose Mobile Augmentation Cloud Services (MACS), a
always be resource-poor, less secure, with unstable connectiv- services-based mobile cloud computing middleware. Android
ity, and with constrained energy. Resource poverty is major applications that use the MACS middleware benefit from
obstacle for many applications [1]. Therefore, computation seamless offloading of computation-intensive parts of the ap-
on mobile devices will always involve a compromise. For plication into nearby or remote clouds. First, from developer’s
example, on-the-fly editing of video clips on a mobile phone perspective, the application model stays the same as on the
is prohibited by the energy and time consumption. Same Android platform. The only requirement is that computation-
performance and functionalities on mobile devices still cannot intensive parts are developed as Android services, each of
be obtained as on their desktop PCs’ or even notebooks’ when which encapsulates specific functionality. Second, according
dealing with tasks containing resource-demanding tasks. to different conditions/parameters, the modules of program are
Recently, the combination of cloud computing [2], wire- divided into two groups; one group runs locally, the other
less communication infrastructure, ubiquitous computing de- group is runs on cloud side. The decision for partitioning
vices, location-based services, mobile Web, etc., has laid is done as an optimization problem according to the input
the foundation for a novel computing model, called mobile on the conditions of cloud side and devices, such as CPU
cloud computing [3]. It provides to users an online access load, available memory, remaining battery power on devices,
to unlimited computing power and storage space. The cloud bandwidth between the cloud and devices. Third, based on the
abstracts the complexities of provisioning computation and solution of the optimization problem, our middleware offloads
storage infrastructure, which the end user uses them as utility parts to the remote clouds and returns the corresponding results
and in reality they can be far away data center or nearby idle back. Two Android applications on top of MACS demonstrate
hardware. the potential of our approach.
In the rest of the paper, we first review related research Zhang et al. [13], [14] use a general Bayesian inference to
work mobile cloud computing in Section II. Then we describe make the partitioning decision. However, executing constantly
our MACS middleware with detailed descriptions of the im- executing graph or inference algorithms on the mobile device
plementation (Section III). We explain the offloading model takes significant resources on the constrained device. We use
in our middleware in Section IV. In Section V we introduce integer linear optimization model to describe the offloading
the two use case applications, the setup of the evaluation so that it is not only easy to implement, but it can also be
and the corresponding evaluation results based on those two independently solved if the remote clouds are temporarily not
applications. After that, we discuss about the results in Section available.
VI. Finally, draw conclusions and refer to the future work.
III. M OBILE AUGMENTATION C LOUD S ERVICES
II. R ELATED W ORK
The goal of our MACS middleware is to enable the execu-
Previous work has proposed many mechanisms that address tion of elastic mobile applications. Zhang et al. [14] consider
the challenges of seamless offloaded execution from a device elastic applications to have two distinct properties. First, an
to a computational infrastructure (cloud). A “brute force” elastic application execution is divided partially on the device
approach to offloading can be considered the encapsulation and partially on the cloud. Second, this division is not static,
of mobile device’s software stack into a virtual machine but is dynamically adjusted during application runtime. The
image and executing it on a more powerful hardware, such as benefits of having such application model are that the mobile
proposed by Chun and Maniatis [6] or Satyanarayanan et al. applications can still run independently on mobile platforms,
[1]. More recently, Kosta et al. [7] have further improved this but can also reach cloud resources on demand and availability.
idea. Although such virtualized offloading can be considered Thus, mobile applications are not limited by the constraints of
as simple and general solution, it lacks flexibility and control the existing device capacities.
over offloadable components. Therefore, we consider that MACS architecture is depicted on Figure 1. In order to
application developers can better organize their application use MACS middleware, the application should be structured
logic using the established Android service design patterns using established Android services pattern. Android is already
and benefit from the MACS middleware. established as the most prominent mobile phone platform.
Ou et al. [8] propose class instrumenting technique, i.e. a Additionally, its application architecture model allow decom-
process to transform code classes into a form which is suitable position of applications into service components which can be
for remote execution. Two new classes are generated from shared between applications. A MACS application consists of
the original class, one is an instrumented class which has the an application core (Android activities, GUI, access to devices
real implementation and the same functionality as the original sensors) which can not be offloaded, and multiples services
class, the other is a proxy class, whose responsibility is only (Si ) that encapsulate separate application functionality (usu-
to call the function written in the instrumented class. Then, ally resource-demanding components) which can be offloaded
the instrumented class can be offloaded to remote cloud, and (SRi ). The services communicate with the application through
the call will be invoked from the instrumented in the remote an interface defined by the developer in the Android interface
cloud. In MACS we adopt similar idea, but unlike Ou et al. [8] definition language (AIDL).
we use standardized language for the proxy interfaces which As service-based implementation is adopted, for each ser-
is already widespread in the Android platform. The Cuckoo vice we can profile following metadata:
framework [4] and MAUI system in [9] implement a similar
• type: whether can be offloaded or not
idea. Our MACS middleware is inspired by these solutions.
• memory cost: the memory consumption of the service on
However, MACS middleware does extra profiling and resource
the mobile device
monitoring of applications and adapts the paritioning decision
• code size: size of compiled code of the service
at runtime.
• dependency information on other services, for each re-
An important challenge in partitioned elastic applications
lated module, we collect following:
is how to determine which parts of code should be pushed
to the remote clouds. The graph based approach to model – transfer size: amount of data to be transferred
the application has been used in several works. Giurgiu et – send size: amount of data to be sent
al. [10] use “consumption” graph and decide which part – receive size: amount of data to be received
should be running locally or remotely by finding a cut of the Metadata is obtained by monitoring the application execution
consumption graph with a goal function, which minimizes the and environment.
total sum of communication cost, transmitting cost and the Android services are using Android interprocess communi-
cost of building local proxies. The AIDE platform [11] uses a cation (IPC) channels to do RPC. The services are registered
component-based offloading algorithm, which mainly focuses in the Service Manager, and a binder maintains a handle for
on minimum historical transmission between two partitions. each service. Then an application, that wants to use a service,
The (k +1) partitioning algorithm, introduced by Ou et al. [8], can query the service in the Service Manager. Upon service
is applied to a multi-cost graph to represent the class-based discovery, the Android platform will create a service proxy for
components. A similar approach is done by Gu et al. [11], [12]. the client application. All the requests to access the service will
execute the service remotely. If there is no such service on
the remote clouds, our framework transmits the service code
(jar file) to the cloud, and the corresponding results after the
service execution are returned to the mobile device. The cloud
caches the jar files for subsequent execution.
Except for the computation offloading, our framework also
features simple data offloading. If files are needed to be ac-
cessed on the remote cloud, MACS file transmission (MACS-
FTM) transfers automatically the non-existed files from the
local device and vice versa.
IV. A DAPTIVE C OMPUTATION O FFLOADING
The proposed model and corresponding algorithm are sup-
posed to be applied for scenario which is computation-
intensive [15], and the requirements for the developer is that
the code should be structured in a model in advance.
Fig. 1. MACS architecture. Application logic is structured from multiple Let us suppose that we have n number of modules which
Android services (Si ). Some of them can be offloaded into the cloud (SRi ).
can be offloaded, S1 , S2 ...Sn . Each of modules has several
properties described as metadata, i.e. for specific module i,
its memory cost memi , code size codei . Let us consider
be sent through the service proxy, and then forwarded to the the k number of related module which can be offloaded.
service by the binder. After processing the requests, results For each of them, we denote the transfer size tr1 , tr2 ...trk ,
are sent back to the service proxy on the client application send size send1 , send2 ...sendk , receive size rec1 , rec2 ...reck ,
through the binder. Finally, the client gets the result from where {1..k} ⊆ {1..n} and sendk + reck = trk . Meanwhile,
the service proxy. From client’s point of view, there is no we introduce xi for module i, which indicates whether the
difference between calling a remote service or calling a local module i is executed locally (xi = 0) or remotely (xi = 1).
function. The solution x1 , x2 ...xn represents the required offloading
The offload manager determines the execution plan, and partitioning of the application.
then the services to be offloaded are pushed to the cloud. The The cost function is represented as follows:
results are sent back to the application upon completion. Our
approach is similar to the Cuckoo framework [4], however, min (ctransf er ∗ wtr + cmemory ∗ wmem + cCP U ∗ wCP U )
x∈0,1
MACS allows dynamic application partitioning at runtime, (1)
where Cuckoo only enables static partitioning at compile where
time. MACS monitors the execution of the services and the n
X n X
X k
environment parameters. Whenever the situation changes, the ctransf er = codei ∗ xi + trj ∗ (xj XOR xi ) (2)
middleware can adapt the offloading and partitioning. i=1 i=1 j=1
The main goal of MACS is to enable transparent com- n
X
putation offloading for mobile applications. Therefore, our cmemory = memi ∗ (1 − xi ) (3)
middleware tries to fit the usual Android development process i=1
and bring the developers an easier way to offload parts of their n
X
applications to remote clouds in a transparent way. MACS cCP U = codei ∗ α ∗ (1 − xi ) (4)
hooks into the Android compile system, makes modifications i=1
of generated Java files from AIDL in the pre-compile stage. There are three parts in the cost function. The first part
Developers need to include MACS SDK libraries into their depicts the transfer cost for remote execution of services, in-
Android project. cluding the transfer cost of its related services which are not at
At the cloud side, the MACS middleware handles the the same execution location. The latter part of Eq.(2) implicitly
offload requests from the clients, installs of offloaded services, includes the dependency relationship between modules, i.e. if
their initialization and method invokes. The cloud-side MACS the output of one module is an input of another. The cmemory
middleware is written with pure J2SE so that it can run on contains the memory cost on the mobile device, and cCP U
any machines with installed J2SE. the CPU cost on the mobile device is, where α is the convert
MACS middleware monitors the resources on the mobile factor mapping the relationship between code size and CPU
execution environment and available clouds. It then forms instructions, which is taken to be 10 based on [16]. wtr , wmem ,
an optimization problem whose solution is used to decide wCP U are the weights of each cost, which can lead to different
whether the service which contains the called function should objectives, for example lowest memory cost, lowest CPU load
be offloaded or not. When the service is determined to be or lowest interaction latency.
offloaded to the remote cloud, our middleware tries first to The three constraints are expressed as the following.
Minimized memory usage. First, the memory cost of n
resident service can not be more than available memory on Ds =
X
sendi ∗ typei ∗ xi (11)
the mobile device, i.e. i=1
n
X Xn
memi ∗ (1 − xi ) ≤ availmem ∗ f1 (5) Dr = reci ∗ typei ∗ xi (12)
i=1 i=1
where availmem can be obtained from the mobile device, where typei ∈ {0, 1} represents whether a service is
f1 is the factor to determine the memory threshold to be used, offloadable or not.
because the application can not occupy the whole free memory Minimized execution time. Third, the third constraint is
on the mobile device. enabled when the user prefers fast execution, i.e.
Minimized energy usage. Second, for the offloaded ser-
tlocal − tof f load > 0 (13)
vices, the energy consumption of offloading should not be
greater than not offloading [17], i.e. The local execution time can be expressed as the ratio
of CPU instructions to local CPU frequency, meanwhile, the
Elocal − Eof f load > 0 (6) remote execution time consists of the time consumed by CPU,
file transmission and the overhead of our middleware.
The local energy consumption can be expressed using the
number of local instructions to be executed Ilocal , local execu- Ilocal
tlocal = ∗ xi (14)
tion speed Slocal and the power used of local execution Plocal Slocal
[17]. At the first decision time, Ilocal is estimated according to
the code size. After the first decision, this number is collected Ilocal Dextra
tof f load = ( + + toverhead ) ∗ xi (15)
from our framework (by calling the statistic method provided Scloud Bs
from Android API). Obviously, there is relationship between where toverhead is the overhead which our framework brings
instruction number and the power used for that instruction in.
while doing power profiling. According to the constraints above, we now transform the
Plocal ∗ Ilocal partitioning problem to an optimization problem. The solution
Elocal = (7) of x1 , x2 ...xn , is the optimized partitioning strategy. By using
Slocal
integer liner programming (ILP) on the mobile device, MACS
The energy cost of offloading some parts to remote cloud gets a global optimization result. Whenever the the parameters
can be expressed as the sum of energy consumption during in the model change, such as available memory or network
waiting for the results from the cloud Eidle , transferring bandwidth, the partitioning is adapted by solving the new
(including sending Es and receiving Es ) the services to be optimization problem.
offloaded [17] and also the additional data which may be Although MACS introduces the overhead because of using
needed on the remote cloud Eextra . a proxy for communication between offloaded services and
the mobile application, the overhead is relatively small, which
is shown in the evaluation part. Our MACS also does the
Eof f load = Es + Eidle + Er + Eextra profiling for each offloaded module/service to dynamically
= Ps ∗ (ts + textra ) + Pidle ∗ tidle + Pr ∗ tr (8) change its execution plan and adjust the partitioning.
V. E XPERIMENTAL E VALUATION OF O FFLOADING
The idle time of the mobile device waiting for the result We evaluate our MACS framework with two use case phone
from cloud can be treated as the execution time of remote applications. The first application implements the well-known
cloud, so the formula becomes N-Queens problem. It is chosen because the performance
bottleneck represents a pure computation problem. This use
Plocal ∗ Ilocal Plocal ∗ Ilocal
Elocal − Eof f load = − case can easily show the overhead introduced by MACS
Slocal Scloud middleware. The second application involves face detection
Ps ∗ (Ds + Dextra ) Pr ∗ Dr and recognition in video files. This use case involves lots of
− − (9)
Bs Br computation, but also requires much more memory resources
where Ds and Dr are the total data sizes to be sent and to process and obtain results.
received, Dextra is the size of extra data needed because of The second case can process a video file, and detect faces
offloading, which is determined at runtime, Bs and Br are the from the video file, cluster them and provide the time point
bandwidths of sending and receiving data, and Scloud is the cues for video navigation. The results can then be used for
remote execution speed. Additionally, faster video navigation on small screen devices (Figure 2). The
video file is processed with OpenCV 1 and FFmpeg 2 libraries.
n
X
1 http://opencv.willowgarage.com
Ilocal = codei ∗ typei ∗ xi (10)
2 http://ffmpeg.org
i=1
Fig. 2. Snapshot of prototype application of face detection and recognition
using MACS middleware
TABLE III
V IDEO DURATION AND FILE SIZE
Duration
10 20 30 40 50 60
(seconds)
Energy
94.98 96.07 95.59 96.37 96.33 96.55
save (%)
TABLE IV
V IDEO DURATION AND SPEED UP OF FACE DETECTION IN VIDEO FILE
Duration
10 20 30 40 50 60
(seconds)
Speed up ×20 ×26 ×23 ×28 ×28 ×29
(a)