Kovachev 2012
Kovachev 2012
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
shortcomings by augmenting their capabilities with external
application parts from the mobile platform into a remote cloud
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
are called elastic mobile applications. Basically, this model of
pattern. The middleware does the heavy lifting of adaptive
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
but also use external resources adaptively. Which portions of
evaluation shows that applications, which involve complicated
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.
785
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
min (ctransf er ∗ wtr + cmemory ∗ wmem + cCP U ∗ wCP U )
approach is similar to the Cuckoo framework [4], however, 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
n
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
786
Minimized memory usage. First, the memory cost of
n
resident service can not be more than available memory on Ds = sendi ∗ typei ∗ xi (11)
i=1
the mobile device, i.e.
n
n
Dr = reci ∗ typei ∗ xi (12)
memi ∗ (1 − xi ) ≤ availmem ∗ f1 (5) i=1
i=1
where typei ∈ {0, 1} represents whether a service is
where availmem can be obtained from the mobile device, offloadable or not.
f1 is the factor to determine the memory threshold to be used, Minimized execution time. Third, the third constraint is
because the application can not occupy the whole free memory enabled when the user prefers fast execution, i.e.
on the mobile device.
Minimized energy usage. Second, for the offloaded ser- tlocal − tof f load > 0 (13)
vices, the energy consumption of offloading should not be The local execution time can be expressed as the ratio
greater than not offloading [17], i.e. of CPU instructions to local CPU frequency, meanwhile, the
remote execution time consists of the time consumed by CPU,
Elocal − Eof f load > 0 (6)
file transmission and the overhead of our middleware.
The local energy consumption can be expressed using the Ilocal
number of local instructions to be executed Ilocal , local execu- tlocal = ∗ xi (14)
Slocal
tion speed Slocal and the power used of local execution Plocal
[17]. At the first decision time, Ilocal is estimated according to Ilocal Dextra
the code size. After the first decision, this number is collected tof f load = ( + + toverhead ) ∗ xi (15)
Scloud Bs
from our framework (by calling the statistic method provided
where toverhead is the overhead which our framework brings
from Android API). Obviously, there is relationship between
in.
instruction number and the power used for that instruction According to the constraints above, we now transform the
while doing power profiling. partitioning problem to an optimization problem. The solution
Plocal ∗ Ilocal of x1 , x2 ...xn , is the optimized partitioning strategy. By using
Elocal = (7) integer liner programming (ILP) on the mobile device, MACS
Slocal
gets a global optimization result. Whenever the the parameters
The energy cost of offloading some parts to remote cloud in the model change, such as available memory or network
can be expressed as the sum of energy consumption during bandwidth, the partitioning is adapted by solving the new
waiting for the results from the cloud Eidle , transferring optimization problem.
(including sending Es and receiving Es ) the services to be Although MACS introduces the overhead because of using
offloaded [17] and also the additional data which may be a proxy for communication between offloaded services and
needed on the remote cloud Eextra . 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
change its execution plan and adjust the partitioning.
= Ps ∗ (ts + textra ) + Pidle ∗ tidle + Pr ∗ tr (8)
V. E XPERIMENTAL E VALUATION OF O FFLOADING
We evaluate our MACS framework with two use case phone
The idle time of the mobile device waiting for the result applications. The first application implements the well-known
from cloud can be treated as the execution time of remote N-Queens problem. It is chosen because the performance
cloud, so the formula becomes bottleneck represents a pure computation problem. This use
Plocal ∗ Ilocal Plocal ∗ Ilocal case can easily show the overhead introduced by MACS
Elocal − Eof f load = − middleware. The second application involves face detection
Slocal Scloud
Ps ∗ (Ds + Dextra ) Pr ∗ Dr and recognition in video files. This use case involves lots of
− − (9) computation, but also requires much more memory resources
Bs Br
to process and obtain results.
where Ds and Dr are the total data sizes to be sent and The second case can process a video file, and detect faces
received, Dextra is the size of extra data needed because of from the video file, cluster them and provide the time point
offloading, which is determined at runtime, Bs and Br are the cues for video navigation. The results can then be used for
bandwidths of sending and receiving data, and Scloud is the faster video navigation on small screen devices (Figure 2). The
remote execution speed. Additionally, video file is processed with OpenCV 1 and FFmpeg 2 libraries.
n 1 http://opencv.willowgarage.com
Ilocal = codei ∗ typei ∗ xi (10) 2 http://ffmpeg.org
i=1
787
Fig. 2. Snapshot of prototype application of face detection and recognition
using MACS middleware
788
(a)
Fig. 5. Energy consumption of N-queens
TABLE III
V IDEO DURATION AND FILE SIZE
789
TABLE V
V IDEO DURATION AND ENERGY SAVE
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)
790
VI. D ISCUSSION R EFERENCES
[1] M. Satyanarayanan, P. Bahl, R. Cáceres, and N. Davies, “The Case for
Offloading perhaps is not the suited for every mobile VM-Based Cloudlets in Mobile Computing,” IEEE Pervasive Comput-
applications, but from the results of the two use cases, we ing, vol. 8, no. 4, pp. 14–23, Oct. 2009.
see that when an application uses complex or time-consuming [2] P. Mell and T. Grance, “The NIST Definition of Cloud
Computing,” 2009. [Online]. Available: http://csrc.nist.gov/groups/
algorithms such as recursion, by offloading those parts into SNS/cloud-computing/cloud-def-v15.doc
the cloud, time and energy consumption are reduced, so that [3] D. Kovachev, Y. Cao, and R. Klamma, “Mobile Cloud Computing: A
the local execution time is reduced to an acceptable level. Comparison of Application Models,” CoRR, vol. abs/1107.4940, 2011.
[4] R. Kemp, N. Palmer, T. Kielmann, and H. Bal, “Cuckoo: a Computation
Offloading can lower the CPU load on a mobile device Offloading Framework for Smartphones,” in Proceedings of the 2nd
significantly. It can also save lots of energy, which indicates International ICST Conference on Mobile Computing, Applications, and
that the battery time can be increased compared to the local Services (MobiCASE 2010), Santa Clara, CA, USA, October 2010.
[5] X. Zhang, A. Kunjithapatham, S. Jeong, and S. Gibbs, “Towards an
execution, as shown in the second use case, where more than Elastic Application Model for Augmenting the Computing Capabilities
90% of energy is saved and the calculation speed is up to 20 of Mobile Devices with Cloud Computing,” Mobile Networks and
times over local execution. Applications, vol. 16, pp. 270–284, 2011.
[6] B.-G. Chun and P. Maniatis, “Augmented Smartphone Applications
The results also prove that the overhead of our framework is Through Clone Cloud Execution,” in Proceedings of the 12th Workshop
small and acceptable with the increase of needed computation, on Hot Topics in Operating Systems (HotOS XII). Monte Verita,
Switzerland: USENIX, 2009.
it is better to push those computations which cost considerable [7] S. Kosta, A. Aucinas, P. Hui, and R. M. X. Zhang, “Unleashing
resources to the remote cloud. But for the small N in the N- the Power of Mobile Cloud Computing using ThinkAir,” CoRR, vol.
Queens problem, the overhead occupies almost half of the total abs/1105.3232, 2011, informal publication.
[8] S. Ou, K. Yang, and J. Zhang, “An Effective Offloading Middleware for
execution time because of the needed computation is small so Pervasive Services on Mobile Devices,” Pervasive Mob. Comput., vol. 3,
that it takes only little time to obtain the results. This shows pp. 362–385, August 2007.
a clear advantage of local execution over remote offloading [9] E. Cuervo, A. Balasubramanian, D.-k. Cho, A. Wolman, S. Saroiu,
R. Chandra, and P. Bahl, “MAUI: Making Smartphones Last Longer
when the needed computation is not much. In a word, the with Code Offload,” in Proceedings of the 8th International Conference
more computation is needed, offloading has more advantage. on Mobile Systems, Applications, and Services (ACM MobiSys ’10). San
Since we use Wi-Fi in the evaluation, the time of sending files Francisco, CA, USA: ACM, 2010, pp. 49–62.
[10] I. Giurgiu, O. Riva, D. Juric, I. Krivulev, and G. Alonso, “Calling the
and receiving results has small proportion, but if 3G or GPRS Cloud: Enabling Mobile Phones as Interfaces to Cloud Applications,” in
are used, the offloading time will surely increase. Proceedings of the 10th ACM/IFIP/USENIX International Conference on
Middleware (Middleware ’09). Urbana Champaign, IL, USA: Springer,
Nov. 2009, pp. 1–20.
VII. C ONCLUSIONS AND F UTURE W ORK [11] X. Gu, A. Messer, I. Greenberg, D. Milojicic, and K. Nahrstedt, “Adap-
tive Offloading for Pervasive Computing,” IEEE Pervasive Computing,
The results show that the local execution time can be vol. 3, pp. 66–73, July 2004.
[12] X. Gu, K. Nahrstedt, A. Messer, I. Greenberg, and D. Milojicic,
reduced a lot through offloading, which is sometimes not ac- “Adaptive Offloading Inference for Delivering Applications in Per-
ceptable for users to wait for, and by pushing the computation vasive Computing Environments,” in Proceedings of the First IEEE
to the remote cloud can lower the CPU load on mobile devices International Conference on Pervasive Computing and Communications
(PerCom 2003). Dallas-Fort Worth, TX, USA: IEEE, 2003, pp. 107–
significantly thanks to the remote cloud, since most of the 114.
computations are offloaded to the remote cloud. Meanwhile, [13] X. Zhang, J. Schiffman, S. Gibbs, A. Kunjithapatham, and S. Jeong,
lots of energy can be saved which indicates users can have “Securing Elastic Applications on Mobile Devices for Cloud Comput-
ing,” in CCSW ’09: Proceedings of the 2009 ACM Workshop on Cloud
more battery time compared to the local execution. The results Computing Security. Chicago, IL, USA: ACM, Nov. 2009, pp. 127–134.
also prove that the overhead of our framework is small. [14] X. Zhang, S. Jeong, A. Kunjithapatham, and S. Gibbs, “Towards an
Our framework supports offloading of multiple Android Elastic Application Model for Augmenting Computing Capabilities of
Mobile Platforms,” in Third International ICST Conference on Mobile
services. If there are multiple services in one application and Wireless Middleware, Operating Systems, and Applications, Chicago, IL,
all of those services can be offloaded to the remote clouds, USA, 2010.
our resource monitor natively supports this situation and can [15] R. Kemp, N. Palmer, T. Kielmann, F. Seinstra, N. Drost, J. Maassen, and
H. Bal, “eyeDentify: Multimedia Cyber Foraging from a Smartphone,” in
make the corresponding allocation determination, so that some Proceedings of the 11th IEEE International Symposium on Multimedia
of the services should be offloaded and the rest of the services (ISM 2009) , 2009, pp. 392–399.
should be run locally. [16] J. K. Ousterhout, “Scripting: Higher Level Programming for the 21st
Century,” IEEE Computer, vol. 31, pp. 23–30, 1997.
The next steps are to enable parallelization of the offloaded [17] K. Kumar and Y.-H. Lu, “Cloud Computing for Mobile Users: Can
services. Additionally, we can extend the current middleware Offloading Computation Save Energy?” Computer, vol. 43, no. 4, pp.
so that it supports automatic partitioning arbitrary mobile 51–56, April 2010.
[18] M. Turk and A. Pentland, “Eigenfaces for Recognition,” J. Cognitive
applications. A great challenge is how to estimate the char- Neuroscience, MIT Press, vol. 3, pp. 71–86, January 1991.
acteristics of an application depending on different input [19] L. Zhang, B. Tiwana, Z. Qian, Z. Wang, R. P. Dick, Z. M. Mao, and
parameters, which is precisely the relationship between the L. Yang, “Accurate Online Power Estimation and Automatic Battery
Behavior Based Power Model Generation for Smartphones,” in Pro-
input of the invoked method and the execution time. We could ceedings of the Eighth IEEE/ACM/IFIP International Conference on
characterize the relationship between execution time and input Hardware/Software Codesign and System Synthesis. ACM, 2010, pp.
parameters by running the target application several times and 105–114.
adapt the offloading algorithm.
791