Top Banner
Diffusing Your Mobile Apps: Extending In-Network Function Virtualization to Mobile Function Offloading ario Almeida Universitat Polit` ecnica de Catalunya [email protected] Liang Wang University of Cambridge [email protected] Jeremy Blackburn Telefonica Research [email protected] Konstantina Papagiannaki Telefonica Research [email protected] Jon Crowcroft University of Cambridge [email protected] Abstract Motivated by the huge disparity between the limited battery capacity of user devices and the ever-growing energy de- mands of modern mobile apps, we propose INFv. It is the first offloading system able to cache, migrate and dynami- cally execute on demand functionality from mobile devices in ISP networks. It aims to bridge this gap by extending the promising NFV paradigm to mobile applications in order to exploit in-network resources. In this paper, we present the overall design, state-of-the- art technologies adopted, and various engineering details in the INFv system. We also carefully study the deployment configurations by investigating over 20K Google Play apps, as well as thorough evaluations with realistic settings. In addition to a significant improvement in battery life (up to 6.9x energy reduction) and execution time (up to 4x faster), INFv has two distinct advantages over previous systems: 1) a non-intrusive offloading mechanism transparent to exist- ing apps; 2) an inherent framework support to effectively balance computation load and exploit the proximity of in- network resources. Both advantages together enable a scal- able and incremental deployment of computation offloading framework in practical ISPs’ networks. 1. Introduction Pervasive mobile clients have given birth to complex mo- bile apps, many of which require a significant amount of computational power on users’ devices. Unfortunately, given current battery technology, these demanding apps impose a huge burden on energy constrained devices. While power hogging apps are responsible for 41% degradation of bat- tery life on average [52], even popular ones such as social networks and instant messaging apps (e.g., Facebook and Skype) can drain a device’s battery up to nine times faster due only to maintaining an on-line presence [26]. Recent work has proposed various solutions to offload and execute functionality of mobile apps remotely in a cloud, referred to as a mobile-to-cloud paradigm [31, 33, 36, 42– 44, 67]. Their evaluations have shown that the energy con- sumption of CPU intensive apps, e.g., multimedia process- ing apps and video games, can be reduced by an order of magnitude [33, 36]. Beside the extended battery life, there are other benefits, such as faster execution time, responsive- ness, and enhanced security by dynamic patching [51]. However, prior work suffers from two limitations. First, they overlooked the potential of exploiting ISPs’ in-network resources for functionality offloading, simply using the net- work as a transmission fabric. Quite different from a decade ago, network middle boxes are no longer simple devices which only forward packets, often featuring multi-core gen- eral purpose processors [19] far more capable than those of mobile devices. In fact, many ISPs’ own network services have been shifting from specialized servers to generic hard- ware with the adoption of the NFV (Network Function Vir- tualization) paradigm 1 . This paradigm can be naturally ex- tended from basic network functions (e.g., packet filtering) to the more general functionality of mobile apps, exploit- ing “last-hop” proximity to effectively reduce latency, net- work load, and improve availability compared to a central- ized mobile-to-cloud deployment. When deployed close to cellular towers (Radio Access Network), offloading latency could be reduced by up to 86.7%, reducing the energy con- sumption and execution time by up to 21.6% and 24.5%, respectively, when compared to a popular cloud alternative (Section 4.4). Furthermore, such a system could potentially be extended to adapt an app’s lifecycle to network condi- tions, further reducing devices’ energy consumption (e.g., delay network dependent background execution [22] in the 1 Telefonica aimed to shift 30% of their infrastructure to NFV technologies by the end of 2016 [29, 60, 61]. Other providers such as AT&T [25], Vodafone [40], NTT Docomo [38] and China Mobile [21] are following similar steps. arXiv:1906.06240v1 [cs.DC] 14 Jun 2019
15

Diffusing Your Mobile Apps: Extending In-Network Function ...

Mar 11, 2023

Download

Documents

Khang Minh
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Diffusing Your Mobile Apps: Extending In-Network Function ...

Diffusing Your Mobile Apps: Extending In-NetworkFunction Virtualization to Mobile Function Offloading

Mario AlmeidaUniversitat Politecnica de Catalunya

[email protected]

Liang WangUniversity of [email protected]

Jeremy BlackburnTelefonica Research

[email protected]

Konstantina PapagiannakiTelefonica Research

[email protected]

Jon CrowcroftUniversity of Cambridge

[email protected]

AbstractMotivated by the huge disparity between the limited batterycapacity of user devices and the ever-growing energy de-mands of modern mobile apps, we propose INFv. It is thefirst offloading system able to cache, migrate and dynami-cally execute on demand functionality from mobile devicesin ISP networks. It aims to bridge this gap by extending thepromising NFV paradigm to mobile applications in order toexploit in-network resources.

In this paper, we present the overall design, state-of-the-art technologies adopted, and various engineering details inthe INFv system. We also carefully study the deploymentconfigurations by investigating over 20K Google Play apps,as well as thorough evaluations with realistic settings. Inaddition to a significant improvement in battery life (up to6.9x energy reduction) and execution time (up to 4x faster),INFv has two distinct advantages over previous systems: 1)a non-intrusive offloading mechanism transparent to exist-ing apps; 2) an inherent framework support to effectivelybalance computation load and exploit the proximity of in-network resources. Both advantages together enable a scal-able and incremental deployment of computation offloadingframework in practical ISPs’ networks.

1. IntroductionPervasive mobile clients have given birth to complex mo-bile apps, many of which require a significant amount ofcomputational power on users’ devices. Unfortunately, givencurrent battery technology, these demanding apps impose ahuge burden on energy constrained devices. While powerhogging apps are responsible for 41% degradation of bat-tery life on average [52], even popular ones such as socialnetworks and instant messaging apps (e.g., Facebook andSkype) can drain a device’s battery up to nine times fasterdue only to maintaining an on-line presence [26].

Recent work has proposed various solutions to offloadand execute functionality of mobile apps remotely in a cloud,referred to as a mobile-to-cloud paradigm [31, 33, 36, 42–44, 67]. Their evaluations have shown that the energy con-sumption of CPU intensive apps, e.g., multimedia process-ing apps and video games, can be reduced by an order ofmagnitude [33, 36]. Beside the extended battery life, thereare other benefits, such as faster execution time, responsive-ness, and enhanced security by dynamic patching [51].

However, prior work suffers from two limitations. First,they overlooked the potential of exploiting ISPs’ in-networkresources for functionality offloading, simply using the net-work as a transmission fabric. Quite different from a decadeago, network middle boxes are no longer simple deviceswhich only forward packets, often featuring multi-core gen-eral purpose processors [19] far more capable than those ofmobile devices. In fact, many ISPs’ own network serviceshave been shifting from specialized servers to generic hard-ware with the adoption of the NFV (Network Function Vir-tualization) paradigm1. This paradigm can be naturally ex-tended from basic network functions (e.g., packet filtering)to the more general functionality of mobile apps, exploit-ing “last-hop” proximity to effectively reduce latency, net-work load, and improve availability compared to a central-ized mobile-to-cloud deployment. When deployed close tocellular towers (Radio Access Network), offloading latencycould be reduced by up to 86.7%, reducing the energy con-sumption and execution time by up to 21.6% and 24.5%,respectively, when compared to a popular cloud alternative(Section 4.4). Furthermore, such a system could potentiallybe extended to adapt an app’s lifecycle to network condi-tions, further reducing devices’ energy consumption (e.g.,delay network dependent background execution [22] in the

1 Telefonica aimed to shift 30% of their infrastructure to NFV technologiesby the end of 2016 [29, 60, 61]. Other providers such as AT&T [25],Vodafone [40], NTT Docomo [38] and China Mobile [21] are followingsimilar steps.

arX

iv:1

906.

0624

0v1

[cs

.DC

] 1

4 Ju

n 20

19

Page 2: Diffusing Your Mobile Apps: Extending In-Network Function ...

MCO Partitions Dynamic No Repackage Stock OS Cloud Network Deployment

MAUI [36] Manual / Method 7 7 3 3 7 7ThinkAir [44] Manual / Method 7 7 3 3 7 3(EC2,cost)

CloneCloud [33] Auto / Thread 3 7 7 3 7 7Comet [42] Auto / Thread – 3 7 3 7 7

Zhang et al. [67] Auto / Class 7 7 3 3 7 7INFv Auto / Class 3 3 3 3 3 3(cache,load)

Table 1: Mobile Cloud Offloading (MCO) systems and properties. The comparison reveals that INFv supersedes the previousdesigns in many aspects. (red cross means the feature is not supported whereas green tick means the opposite.)

case of congestion) and the volume of signaling offloaded tothe Core Network (CN) [54]. Unfortunately, previous sys-tems either failed to address the challenges of deployingand scaling mobile code offloading systems at all, or over-looked the opportunities to effectively exploit in-network re-sources. Second, these solutions often utilize intrusive of-floading techniques which either require custom OS distri-butions [33, 42], app repackaging [67], or even alternativeapp stores, not only increasing security risks and deploymentcosts, but also greatly increasing the barrier to the marketadoption.

This paper presents INFv, the first mobile computationoffloading system able to cache, migrate, and dynamicallyexecute mobile app functionality on demand in an ISP net-work. It uses advanced interception and automatic app par-titioning based on functionality clustering, combined within-network load balancing algorithms to perform transpar-ent, non-intrusive, in-network functionality offloading. INFvaims to bridge the gap between the limited battery capac-ity of user devices and the ever-growing energy demandsof modern mobile apps[26, 52] by extending the promisingNFV paradigm to mobile apps. More specifically, we makethe following contributions:

1) We present INFv’s data-driven architecture and design,along with key mechanisms and various technical detailsrequired to achieve non-intrusive offloading and adaptive in-network resource management.

2) We show that INFv is able to greatly improve appsenergy consumption (reduced by up to 6.9x) and speed upapp execution (up to 4x faster). It performs similar to, orbetter than, local execution 93.2% of the time over 4G whileadapting to dynamic network conditions and up to 24.5%faster than a cloud alternative.

3) We compare different strategies to effectively balancefunctionality load in the network while reducing both end-user-experienced latency and request drop rates.

4) Through a real mobile app market study we show thatapp’s storage cost can be reduced by up to 93.5%, and thattop apps have a median of 17 distinct functionality clusters,with up to 57% of offloadable code.

2. Background & Related WorkMobile Code Offloading (MCO) is a reasonably well ex-plored area (see Table 1), however earlier work has a fewlimitations that we directly address with INFv. In this sectionwe provide an overview of previous work, focusing on thelessons taken away that we used to design INFv. MCO sys-tems can be differentiated based on their granularity and par-titioning decisions (what to offload), offloading techniques(how to offload), and runtime decisions (when to offload).

What to offload can be defined in a manual (app devel-oper assisted) or in an automated manner. The first can beaccomplished via programming frameworks and/or code an-notations. For programming frameworks [31, 43, 44], bothlocal and remote execution alternatives have to be imple-mented according to the framework’s design constraints(e.g., concurrency models). In Maui [36], annotations allowa partially automated offloading solution where developersselect methods to offload. The benefit of these explicit sys-tems is the level of customization; developers have a largedegree of control over how their apps are offloaded.

An alternative approach taken by other work is to makeautomated offloading decisions [33, 42, 67] by performingstatic and dynamic analysis of apps. While automated ap-proaches give up a degree of flexibility, they benefit from be-ing able to leverage the existing app ecosystem and generalease of use. That said, these systems do not really focus onthe deployment characteristics of offloading. Thinkair [44]and Cloudlets [57], however do to some extent. Thinkair al-lows on-demand execution in a cloud environment. It pro-vides 6 different VM types, with varying CPU and mem-ory configurations. Mobile devices upload specially craftedapps to the cloud, and their local counterpart negotiates theon-demand execution on one of these VMs. A more ro-bust approach (one that we have taken) is to support exist-ing apps while handling resource negotiation and function-ality caching in a fully automated and transparent manner.In particular, we want to ensure that INFv supports hetero-geneous network topologies and load balances cached func-tionality in an intelligent manner. Cloudlets [57] in partic-ular serves as a motivation for INFv as it highlights theimpact of high latency in MCO to justify the need for de-ploying physically proximate decentralized clusters to exe-cute functionality. INFv directly addresses the problems and

Page 3: Diffusing Your Mobile Apps: Extending In-Network Function ...

challenges raised in this work by proposing an in-networksolution (“Network” in Table 1) for MCO.

The majority of offloading literature proposes a methodoffloading granularity [31, 36, 43, 44]. CloneCloud [33] andComet [42] propose full or partial thread granularity. Au-tomated method granularity architectures incur the cost ofsynchronizing the serialized method caller objects, param-eters, changed state and return object. Thread granularityarchitectures often need to synchronize thread state, virtualstate, program counters, registers, stack or locks. INFv is thefirst to address the challenges behind caching app function-ality, complementing its granularity design with a real mar-ket study to reduce its app storage requirements.

How to offload depends on the aforementioned charac-teristics. Manual approaches tend to use custom compilers(e.g., AspectJ) or builders. Automated solutions often oper-ate on compiled apps and rely on byte-code rewriting [67]or VM modifications [33, 42]. Altering an app generally re-quires repackaging and resigning it, which also implies theneed for a new distribution mechanism incompatible withcurrent app markets. Each of the above architectures, ex-cept for Comet [42] (a distributed shared memory solution),need either app repackaging, re-writes, or both, impactingtheir likelihood of adoption. INFv offloading differs mainlyin that it does not require a custom distribution, manual in-tervention or app-repackaging even in the presence of appupdates. It allows for dynamically loaded partitions (“Dy-namic” in Table 1) and is fully reversible.

When to offload was mostly done using thresholds [42]or Integer Linear Programming [33, 36] based on the appprofiling metrics.Similar to CloneCloud, INFv relies on UIinstrumentation to profile the different execution paths ofapps. INFv performs app profiling on remote servers to re-duce the overhead on mobile devices and like Thinkair [44],its energy model is based on PowerTutor [66]. INFv im-proves previous systems by offloading together functionalitywith high communication based on their runtime invocationfrequency.

Clone detection literature [37, 46, 50, 55] focused on de-tecting app cloning using class/method names and tend toignore minor custom changes to the functionality. In codecaching, we are more interested in the unmodified use ofthird-party libraries than similar code. Unlike recent stud-ies [46, 50, 64], some initial works [37, 55] did not considerobfuscation, which can impact the statistical significance oftheir results. In [50] and [46] the authors study obfusca-tion based on class names. Unfortunately, they do not con-sider package obfuscation which affects the offloading rout-ing mechanisms. Wukong et al. [64] focused on clone detec-tion based on Android API calls, and while it highlights thechallenges in overcoming obfuscation, we have found strongevidence that, a simple package name filtering might sufficeto detect obfuscation at a package level.

VMVMApp

VM

App Analysis

Repository

NFV NFV

INFv

VM VM

INFv

INFv

INFv

Barebone

Routing overlay

INFv overlay

F

F

FM

Partition functionalityPartition metadata

M

M

M

M

Figure 1: Design of INFv overall system, the three subsys-tems are divided with gray dashed lines.

Mobile Edge Computing [35] (MEC) is an industryinitiative2 whose goal is to provide computing capabilitiesat the edge of the cellular network. Its focus is explicitly onthe infrastructure and deployment and not on the potentialapplications. That said, INFv can be considered an obvioususe case of MEC and the first full-fledged MCO architectureto exploit its potential.

Runtime patching has been used to dynamically pro-vide updates to apps. OPUS [24] focused on providing dy-namic software patching to C programs, while POLUS [30]was more focused on updating long-lived server side apps.More recently, such techniques were brought to Androidwith PatchDroid [51]. It focused on security vulnerabilitiesand proposed a system to distribute and apply third-party in-memory security patches. Inspired by these systems, INFvmodifies a single Android OS binary to extends app’s func-tionality at runtime, providing mechanisms similar to thoseof aspect oriented programming.

3. Design Goals & ArchitectureBased on the limitations of previous work, and keeping inmind the recent availability of in-network resources, weidentified four major design requirements for INFv as wellas their corresponding challenges.

Instrumenting apps: App instrumentation is needed forprofiling and providing offloading capabilities. How canapps be modified without performing app repackaging, usingspecialized compilers, custom OS or app stores?

Understanding apps: With instrumentation in place,how to detect which functionality is consuming the mostenergy or executing for longer? Can we analyze apps with-out incurring a performance penalty on mobile devices?

Offloading functionality: How to enable apps to makeuse of remote resources in a transparent and efficient mannerwith minimal adoption cost? Can offloading adapt to a dy-namic network environment and still ensure its energy andperformance benefits?

Caching functionality: How to cache functionality in anetwork, adapting to demand and reducing latency, even forarbitrary network topologies and heterogeneous nodes?

2 supported by Huawei, IBM, Intel, Nokia, NTT DOCOMO and Vodafone.

Page 4: Diffusing Your Mobile Apps: Extending In-Network Function ...

Deployment assumptions: Based on recent/expectedNFV/MEC adoption by ISPs, we believe these standards willsoon be widely available in the ISPs networks. More specif-ically, and in compliance with the MEC proposal, placed inthe Radio Access Network (RAN), where traffic offloadingfunctions can be implemented to filter packets based on theirend-point [35, 62] (IP protocol).

The overall INFv architecture that addresses these chal-lenges is depicted in Fig. 1. It is divided in three differ-ent logical subsystems (separated by dashed lines), each ad-dressing the aforementioned challenges. The leftmost sub-system (Section 3.2) profiles and analyzes apps. The right-most subsystem (Section 3.3) provides the on device offload-ing capabilities. It runs on the user device and executes codeon a remote VM in the network. Finally, the third subsystem(Section 3.4) runs on the network nodes (NFV) and is re-sponsible for caching functionality and balancing the com-putation load. In the next sections we detail each of them anddescribe their technical challenges.

3.1 Dynamic instrumentationINFv’s mechanism to extend app functionality has to haveminimal impact and high coverage of devices, i.e., it can-not rely on app repackaging, specialized compilers, cus-tom OS or app stores. To avoid modifying app binaries andchange apps’ signatures, INFv targets the minimal set ofchanges required to provide dynamic instrumentation – a re-versible binary patch to Android’s app process. This pro-cess is launched at boot (by the init.rc script) and launchesZygote – Android’s daemon responsible for launching apps,creating the Dalvik VM and pre-loading Java classes. Whena new app is to be launched, this process is forked and theapp executes on its own VM with its copy of the systemslibraries. By extending this process INFv can add its ownclasses to the classpath and redirect method invocations toa generic redirection method that allows specifying methodsto be intercepted (i.e., hooks).

There are a few dynamic instrumentation frameworksavailable for Android, that follow similar techniques, suchas Xposed [13], Cydia [4] and adbi [2]. INFv is based on thefirst as it is by far the most popular. As shown in Fig. 2, INFvextends it to enable app profiling (Resource Manager – RM),manipulate app lifecycle (App/Thread Manager), performremote method invocation (Hook Manager and the genericoffloading hook – H) and instantiates a custom classloader(DexClassLoader) to dynamically load only its signed appli-cation strategies and functionality in the backend (PartitionManager). These are detailed in the next sections and theirlimitations and security concerns discussed in Section 6.

3.2 Profiling and PartitionsIn MCO, apps are typically partitioned into a set of func-tionality to execute locally and another to execute remotely.Such systems need to detect good candidates to offload, e.g.,based on energy consumption and execution time. Next,

Hook Manager

Request Manager

App/Thread Manager

Network Stub

AppConnector

App Code H

H

H

Per-app (INFv monitor) Per-phone

RMPartition Manager

Figure 2: INFv mobile architecture. All components exceptthe Network Stub and the Resource Manager (RM) are con-tained within the app process.we describe how INFv partitions are designed and howthe environment-dependent properties (e.g., network con-ditions) are considered for offloading decisions.

3.2.1 App Analysis & ProfilingDesigning functionality partitions requires app knowledge.In INFv most of app analysis is done offline (left-most sys-tem in Fig 1) and is composed of two steps. The first consistsof performing static analysis of the app, i.e., the app analysisplatform retrieves an app from the Google Play (GP) store,decompiles it (using apktool[3]) and parses both the man-ifest and smali files (i.e., disassembled Dalvik bytecode).From the first we retrieve the app properties, such as pack-age name, version and app starting points (e.g., activities,broadcast receivers, etc). From the second we build a callgraph where the vertexes represent classes and the edgesmethod calls. This call graph is used to detect accesses tomethods/classes that should execute locally, such as accessto local hardware 3 and UI 4. Our static analysis tool 5 in-cludes a DSL to tag packages which we used to manuallypre-tag most of the Android packages depending on their re-quirements.

The second step consists of attributing weights to the callgraph edges based on their runtime invocation counts as wellas metadata regarding vertices’ energy consumptions andexecution times. Apps are executed in instrumented VMsand exercised using UI automation (reproducible pseudo-random input [9]). These VMs use the aforementioned in-strumentation mechanisms to load the call graph on appstart and intercept method invocations. We had to performsome optimizations to reduce the tracing overhead, such asincreasing the VM heap size and restricting the tracing toapp methods. The average of the intercepted methods pa-rameters are registered in the call graph metadata – statesize, thread, execution time, invocation counts – along withthe predicted energy consumption based on the PowerTu-tor model [66]. This model uses the device states (CPU,screen, GPS, connectivity) to predict energy consumption.It can derive a per device power model (with a low errorof up to 2.5%) by performing regression over the energy dis-charge patterns observed while looping through different de-

3 Android’s bluetooth, hardware, MTP, NFC and telephony packages.4 Android’s Activity, View, Widget, Gesture, Text, Transition, Animationand Graphics packages.5 We made our static analysis tools open-source [14, 15].

Page 5: Diffusing Your Mobile Apps: Extending In-Network Function ...

vice power states. The INFv dynamic analysis platform canaccommodate physical devices to automate this process, ora one time power discharge execution can be run in usersdevices to retrieve the specific device model. We report thatthe minimal information needed by our offloading mecha-nisms requires on average 3MB per app when uncompressed(based on the top 30 market apps), which is reasonable evenconsidering Android’s memory constraints (i.e., small heapsize – 48MB in Galaxy S2).

While INFv’s approach saves the profiling energy onmobile devices as well as the overhead of method tracing,we do acknowledge some limitations. Some of the powermodel metrics (e.g., screen, GPS) are not accurate or ob-servable in a VM. The VM screen is always on and somenetworks/sensors are emulated. While the second is unim-portant as these should execute locally anyway, the first mayoverestimate energy consumption which later prevents somefunctionality from being offloaded. We discuss some of theselimitations in Section 6.

3.2.2 App PartitionsPartitions define which subsets of functionality should beoffloaded. In MCO, partitions are generally static and theiroutcome is a rebuilt app (potentially two disjoint apps) withsome functionality re-purposed for offloading. In INFv’sclient, partitions are just information regarding the offload-ing subset, i.e., class names and execution properties (e.g.,execution time, energy consumption, network conditions).These sets are pushed to the device, loaded on app launchand drive app’s execution.

Partitions can be devised on method and thread granular-ity. The latter incurs an extra cost of synchronization (e.g.,thread state, virtual state, program counters, registers, stack),and is often restricted to method boundaries [33]. In orderto better integrate with the NFV abstraction, our solution isable to provide the granularity of method offloading. How-ever, since most mobile architectures apps are developed inclass-based object-oriented languages, in practice we use aclass offloading granularity as methods often invoke meth-ods of the same class and share class state (e.g., class fields).Furthermore, there is a large overlap of classes and pack-ages across apps, which minimizes the impact of storing appfunctionality in the network (Section 5.1).

One of the main concerns in MCO is the balance betweenoffloading computation and its communication overhead dueto remote method invocations. To reduce this overhead, weuse the app call graph (Section 3.2.1), i.e., G = (V,E)where V is the set of app classes and E the invocationsbetween classes, to detect communities/clusters (sub-graphsof G) of V based on their invocation counts. INFv uses acommunity detection algorithm – Girvan and Newman (GN)[41] to detect edges that are likely between communities.To do so it recursively detects the edge with highest num-ber of shortest paths between pairs of nodes passing throughit (i.e., the edge with highest betweenness) and removes it.

By removing edges with high betweenness, the communitiesget separated and we end up with distinct functionality clus-ters. Community detection was firstly proposed by Zhanget al. [67] which used static analysis invocations as edgeweights. The problem is that these do not reflect the actualruntime invocation counts between classes, and so the studyrelies on a weight heuristic based on class semantic simi-larity, i.e., class names and their textual contents. Unfortu-nately, our app study in Section 5.1 indicates that 82% of theapps perform class name obfuscation and in some cases eventhe strings within classes can be obfuscated [5]. As INFvexecutes apps, it registers the method’s runtime invocationcounts, bypassing such limitations.

The GN algorithm receives the number of clusters as aparameter which we iterate from two to the optimal num-ber of clusters as calculated via louvain’s [27] modularity(density of links within clusters) optimization. Any partitionwith classes tagged during static analysis as non offload-able is discarded. In Section 3.3.1 we discuss how these pre-calculated partition sets are picked for offloading at runtime.

3.3 Offloading FunctionalityOnce INFv fetches the partition metadata, it needs to provideoffloading capabilities and a decision model to ensure that itexecutes faster and consumes less energy.

The INFv end device system (Fig.2) is composed by oneor more monitors and one standalone process that provides anetwork stub and a resource monitoring (RM) system. Eachapp process transparently loads and executes an INFv moni-tor on start. The App Manager intercepts the app entry pointsdeclared in the manifest and binds to the per-device Net-work Stub. The Partition Manager (PM) loads the partitionsand instructs the Hook Manager to hook their entry and exitpoints, enabling the interception of their respective members(methods & constructors). Once a target invocation is inter-cepted, the PM retrieves the current environment-dependentmetrics from the RM and decides whether to offload it ornot. If so, a message is created and sent by the AppConnec-tor to the Network Stub service (via IPC) that transparentlyinteracts with the closer network node to execute it. Networknodes abstract the network topology by providing a messagequeue (MQ) between the stub and the execution backend.Within the MQ abstraction, routing is done using the user,device, app and version IDs, along with the fully qualifiedmember name and its arguments. The Thread Manager keepsa per-thread queue of the offloaded requests and suspends thethreads until the invocation result is received or there is anintermediate invocation of a member in the same thread.

The INFv backend subsystem runs the same monitorfunctionality over a light-weight app process. It loads onlythe required functionality and listens for incoming requests(Request Manager) from the mobile device. On request itcreates class instances and executes their respective meth-ods while managing their state. Although mobile apps areexpected to be short-lived (imposed by screen off events and

Page 6: Diffusing Your Mobile Apps: Extending In-Network Function ...

CPU sleep mode), state has to be kept while there are ref-erences to it. In INFv, remote class instances are replacedlocally with “light-weight” instances of the same class (by-passing their constructors [18]), which, on interception,work as proxy objects. These objects are tracked using acustom weak identity hash map that allows the detection ofde-referenced or garbage collected objects, which results ina state invalidation message being sent through the INFv net-work stub. App crashes or force quit also trigger state inval-idation. If the crash is INFv’s specific, as apps are isolated,the instrumentation can be disabled for the specific app. Fi-nally, when there are no requests or remaining references theVM can be paused after a certain period. More advanced dis-tributed garbage collection mechanisms can be implementedthat address some of aforementioned challenges [20].

While INFv’s offloading model resembles Java RMI,not only does Android’s Java not support RMI by default,but it generally requires a remote interface (e.g., extendingjava.rmi.Remote). Refactoring classes is possible at runtimeusing bytecode manipulation but is either expensive if doneat launch time or significantly increases the app size by upto 40% [67] when stored.

3.3.1 Runtime DecisionsAt runtime the PM decides which of the (offline) pre-calculated partitions should be offloaded. This decision isbased on the partition’s (offline) estimated execution param-eters (Section 3.2) and the periodic device measurementsand state monitored by the RM – network type, bandwidthand latency. In previous class offloading research [67], apartition would only be valid for offloading if, for each ofits classes, all methods perform faster when offloaded. Un-fortunately from our experience this rarely holds, even forCPU intensive classes. For example, simple methods suchas an overridden toString() or equals(), will in most situa-tions perform worse than local when offloaded due to theRTT. In INFv, instead of considering methods individually,for each class we aggregate its method’s execution and en-ergy consumption based on their observed method invoca-tion frequency (fi). Therefore, methods that perform betterwhen offloaded can compensate for the least performingmethods if these do not occur too often. A class c is validif:

∑Mm=1 fm ∗ tm local >

∑Mm=1 fm ∗ (RTT + (im +

om)/r + tm offload), where M represents the number ofclass methods and fm the method’s invocation count nor-malized by the total number of invocations observed for allthe class methods. The size of the method’s input and outputparameters are represented respectively as im and om. Theseare divided by the transmission rate (r) and, along with theRTT, are only counted for methods interfacing between thelocal and remote partitions (partition boundary). Finally thelocal (tm local) and remote (tm offload) execution times area function of the CPU frequency difference between the mo-bile device and the node.

Classes are similarly validated based on the energy con-sumption of their edges, except that a method’s energy con-sumption is only considered for edges that bridge parti-tions. For these methods (technically the edges between suchclasses), only the state transmission costs and the normalizedinvocation frequency are used when calculating the class’senergy consumption.

INFv validates the pre-calculated partitions by increasingthe number of partitions (N ) until it finds a valid partition. Inthe worst case scenario N is equal to the number of classesand valid classes are offloaded individually6.

Finally, the existing Android diagnosis resources(dumpsys) are used to report potential anomalies (e.g., highenergy consumption) and processed (offline) by a negativefeedback loop to reduce the deviations between estimatedand observed values. An advantage of INFv over app repack-aging systems is that it is able to dynamically load new par-titions and metadata to handle such cases.

3.4 Network SubsystemThe network subsystem abstracts the communication be-tween mobile devices and the executing backend. It canbe deployed on ISP’s RANs where the latency to the UserEquipment (UE) is minimal (15-45ms [45]). Offloading re-quests share a common end-point IP, which can be inter-cepted directly at the base station [35, 62], where INFv ter-minates the traffic and performs further routing. INFv uses apub-sub MQ system (as proposed by MEC) to store the pro-cessed requests while the routing decisions take place and toperform in-network communication.

Because nodes cache functions, there will be multiplecopies in the network. The first job of the network subsystemis to route user requests to the closest copy. Functionalityexecution consumes both CPU and memory as well as otherresources (e.g., bandwidth). INFv focuses on the first twosince they are usually the most dominant resources. Thesecond job of the network subsystem is to balance the load ofexecuting functions. The goal of load balancing is achievedby strategically dropping or forwarding computation tasksto other nodes to avoid being overloaded. However, insteadof distributing load uniformly over all available nodes, aservice is better executed as close to a client as possible tominimize latency.

Centralized coordination is not ideal for practical deploy-ment due to three reasons: 1) A central solver needs globalknowledge of a network and maintaining such knowledgeup-to-date is costly, 2) the optimal strategy needs to be calcu-lated periodically given the dynamic nature of network andtraffic, and 3) there is a single point failure. Therefore, westudy and implement two basic heuristic strategies – passive& proactive in INFv. Both strategies have rather straightfor-ward implementations and try to minimize latency. For theproactive one, we apply a simple M/M/1-Processor Shar-

6 In practice, a threshold is selected via modularity optimization [27] toavoid high link density classes to be executed separately.

Page 7: Diffusing Your Mobile Apps: Extending In-Network Function ...

INFv

INFv

Monsoon

4G

Repo

Docker instances

INFV

AndroidAndroid

MQTT

ProfilerUnmodified app

TCApp

App

App

Figure 3: Experimental setup.

ing (i.e., M/M/1 − PS) queuing model to estimate the fu-ture queue length. The workload on each node can be fur-ther estimated based on the predicated queue length and pe-riodically measured CPU and memory consumption of eachfunction. Next we sketch the core idea behind each heuristic;please refer to [65] for further algorithmic details.

Passive Control: Nodes execute as many requests aspossible before being overloaded. If the node is overloaded,the requests are passed to the next hop along the path to aserver, or dropped if the current node is already the last hopin the ISP network.

Proactive Control: Nodes execute requests conserva-tively to avoid being overloaded. To do so, a node estimatesthe request arrival rate to further estimate the potential con-sumption. If the estimate shows that the node may be over-loaded, it executes some and forwards the rest to the nexthop neighbor with the lightest load. NB: This strategy re-quires exchanging state information within a node’s one-hopneighborhood.

4. Architecture EvaluationWe first describe how a typical deployment of INFv thenpresent thorough evaluations demonstrating that INFv deliv-ers on its promise of energy savings and faster app execution.

INFvs use case: 1) The profiler analyzes apps and com-putes partition sets; 2) The user equipment (UE) installsapps and the local INFv installation downloads their parti-tion metadata; 3) The UE launches apps, and if the networkconditions (bandwidth & latency) are favorable, the execu-tion is offloaded; 4) the INFv network system forwards of-floading request to an available backend, and finally, 5) thebackend executes requests.

Our experimental setup is shown in Fig. 3. Both INFv’snetwork subsystem and the MQ system are run withindocker containers. The selected MQ protocol was MQTT(optimized for mobile devices) and our messages are en-coded with protocol buffers [28]. The app profiler utilizeshardware-level virtualization (Android x86) to profile theuser apps. Power measurements are taken with a MonsoonPower Monitor and latency is emulated using TC NetEm

(Traffic Control Network Emulation). In all experiments,phones are factory reset with Android 4.4, no Google ac-count, and INFv pre-installed. In Section 4.2 and 4.1 weused a Galaxy S2 (i9100) and offload to an Intel Q6600(4GB of RAM and a 100 Mbit fiber connection). Section 4.4

0

1

2

3

4

All3G AllWifi Lin3G LinWifi Local 4TLinpack offloading policy

Spee

d up

0

5000

10000

0.02MB 0.07MB 0.28MB 0.67MB 1.2MBImage size

Exec

utio

n tim

e (m

s)

Experiment 3G Local Wifi

0

5

10

15

0.00 0.25 0.50 0.75 1.00 1.25Image size (MB)

Joul

es

Experiment 3G Local Wifi

A

C

B

D

Figure 4: Benefits of mobile code offloading for two apps:Linpack and FaceDetect.

uses a more up-to-date setup: a Galaxy S5 and an Intel i74790K (16GB RAM, 300 Mbit fiber). Additionally, while3/4G setups use real mobile networks, in WiFi the UE andbackend share a common WiFi access point.

The offloaded apps were Linpack [17], FaceDetect,QuickEditor [11], and QuickPhoto [12]. Linpack is computa-tionally intensive and FaceDetect has high state transmissioncosts and have been widely used to benchmark MCO perfor-mance [44, 58, 67]. QuickEditor and QuickPhoto both useGoogle Drive, and although not computationally intensive,they exemplify 1) how INFv can target common functional-ity across apps and 2) how INFv can provide functionalityotherwise absent from a device. Each app is standalone, i.e.,no client/server counterpart, and has no special design deci-sions or implementation to facilitate code offloading.

4.1 Impact of Code PartitionsLinpack measures a system’s floating point computingpower by randomly generating a dense matrix of floatingpoint numbers on [−1, 1] and performing LU decomposi-tion for M cycles (iterations). We added support for multi-threading, a feature many previous automated offloadingarchitectures do not or only partially support [33, 36, 43].We experimented using two different offloading partitionsets. For the first (All), GN provides two partitions that min-imize network communication: 1) a partition that interactswith the UI, therefore invalid for offloading, and 2) a validpartition that performs computation, i.e., all computation isperformed remotely and there is almost no communicationcosts as threading occurs on the backend. The second (Lin)represents the worst case scenario by offloading individualclasses (i.e.N partitions whereN is the number of classes inthe app). For Lin, only the Linpack class and calculations areoffloaded, and thus, threading, as well as pre- and post-cycleprocessing, occurs on the client with a higher communica-tion penalty. For this experiment (and the next) we perform

Page 8: Diffusing Your Mobile Apps: Extending In-Network Function ...

unconditional offloading (i.e. no runtime decisions) to depictthe partition trade-offs.

Fig. 4A plots the speed up for the Linpack benchmarkrunning 4 threads, showing that INFv provides the expectedcomputational performance benefits of code offloading. Forthe All partition, INFv achieves a speed up over 4.0x onboth WiFi and 3G since there is almost no communication.When the more restrictive partitioning (Lin) is used, the WiFiexperiment achieves a 1.57x speed up. However, the 3Gexperiment shows reduced performance (0.73 speed up), dueto the 3G latency and the high frequency of communication(up to 40 messages, 10 per thread, for each cycle).

Next, Fig. 4B plots the distribution of power consump-tion for both partition sets. The local execution with 2 and4 threads had a median power consumption of 3 and 6W,respectively; for offloaded executions it was below 2W. Forthe WiFi All partition, the quartiles show a tight distributionof power consumption and, since the UE was mostly idlewith a mean energy consumption close to the observed An-droid background activity (dashed line), the overall energyconsumption was reduced by up to 4 times.

Offloading without modularity optimizing can resultin reduced performance in high latency networks despitethe power consumption reduction. Taken together, Fig. 4Aand 4B, show that INFv’s MCO provides real benefits butalso demonstrates the trade-offs of different partitionings.

4.2 Cost of State SynchronizationThe FaceDetect (FD) app, which finds the coordinates offaces in images, is useful for measuring the trade-offs be-tween data transfer and computational speed up. The of-floaded partition contains the classes interacting with theface detection APIs and the client device just sends the un-derlying Android Bitmap object and receives an array ofcoordinates. The execution time and power were measuredfrom when the app starts up to when the results are drawn onthe screen. To test the impact of data transfer, we use mul-tiple images from the AT&T face database [16] ranging insize from 0.02MB to 1.2MB.

Fig. 4D plots the execution time as a function of imagesize and we can see that local execution is faster for images≤ 0.07MB. This is because detecting faces in small imagesdoes not have enough computational cost to outweigh thecommunication costs of offloading. For larger images, theWiFi communication costs are compensated by the VM pro-cessing speed. For example, with the 1.2MB image, usingWIFI has an execution speed 1.45x faster, but for a 0.2MBimage offloading was 3.86x slower. Unfortunately offload-ing was never justified (in terms of execution time) over 3Gdue to its high latency.

Fig. 4C plots the total Joules FaceDetect consumed, notcounting baseline OS consumption. We note that for smallimages (≤ 0.25MB), local execution results in less powerconsumption than 3G, although after this point, offload-ing over 3G saves energy. Offloading over WiFi results in

20 40 60 80 100 120 140

PAS

n 1 load

0

0.5

1

0.885 0.881

Whole time span

20 40 60 80 100 120 140

PAS

n 2 load

0

0.5

1

0.089 0.070

20 40 60 80 100 120 140

PRO

n1 lo

ad

0

0.5

1

0.679 0.589

20 40 60 80 100 120 140

PRO

n2 lo

ad

0

0.5

1

0.318 0.367

40 41 420

0.5

1Jitter #1

40 41 420

0.05

0.1

0.15

40 40.5 41 41.50

0.5

1

40 41 420

0.1

0.2

0.3

70 750

0.5

1Jitter #2

70 750

0.1

0.2

0.3

70 750

0.5

1

70 750

0.2

0.4

0.6

Figure 5: Comparison of two control strategies by examiningtwo adjacent routers: client → router n1 → router n2 →server. Two jitter are injected at time 40 ms and 70 ms. x-axis is time (ms) and y-axis is normalized load. Red numbersrepresent the average load during a jitter period.

lower power consumption than local execution for all but thesmallest image in the dataset. For example, an image with1.2MB consumes 1.9x less battery when offloaded via 3Gconnectivity and 6.9x less battery if offloaded via WiFi. Inthe case of WiFi, the decreased execution time due to theVM processing power is the significant factor in energy sav-ings. The 3G energy consumption is higher than WiFi fortwo reasons: 1) there is additional radio overhead for 3G and2) the total execution time is larger due the higher RTT.

The main take away from these experiments is that, as inthe Linpack experiments, INFv’s offloading engine providesboth computational and energy benefits. However, if there issubstantial interaction between local and offloaded objectsthat involves passing a lot of data, it can result in a net loss ofperformance. In Section 4.4 we show how profiling metadatacan be used to prevent such scenarios.

4.3 Responsiveness to JitterNext, we study how INFv’s control strategies respond tosudden increases in workload (i.e., jitter). We setup a toynetwork topology composed of a client, two routers (n1and n2), and a server (acting as a catch-all for requests nothandled by n1 or n2); i.e., client → router n1 → router n2→ server. We simulate the client’s request flow at a stablerate of λ = 1000/s but inject two instances of jitter at 6λfor 10ms at time 40ms (j1) and 70ms (j2). Fig. 5 plots theworkload over time when the routers use a passive strategy(PASn1 and PASn2 in the first two rows) vs. a proactivestrategy (PROn1 and PROn2 in the second two rows). Thetwo right most columns zoom in to the period when j1 andj2 have just occurred.

For passive control, PASn1 takes most of the load (88%),exhibiting consistent behavior for both j1 and j2. How-ever, the proactive routers show an interesting variation. Forj1, although PROn1 successfully offloads 31.8% of load toPROn2, it also experiences high load for a period of 2ms(row 3, column 2). After j1, however, PROn1 enters a con-

Page 9: Diffusing Your Mobile Apps: Extending In-Network Function ...

A B

C

0

1

2

3

4

0 5 10 15 20Experiment (4G INFV)

Powe

r (W

)

0

1

2

3

4

0 5 10 15 20Experiment (NO INFV)

Powe

r (W

)

0123

100 120 140 160 180Time (s)

Powe

r (W

)

Figure 6: Power consumption distribution (A & B) for 20executions over 4G, with and without INFv. Crosses rep-resent the median. In C the dashed line represents INFvs’consumed power versus the local execution (continuous).

0.6

0.8

1.0

Exec

utio

n Ti

me

0.4

0.6

0.8

1.0

100 200 300 400Mean Latency (ms)

Ener

gy (W

s)

Figure 7: Energy and execution time of FaceDetect execu-tion with INFv enabled. Crosses represent the median. Val-ues are normalized by the mean values of local execution.

servative mode. Thus, when j2 arrives, the load curve onPROn1 is much flatter with no clear peak appearing at all.Instead, it proactively offloads more tasks to PROn2, result-ing in PROn2 absorbing about 36.7% of the load from j2.Between 80 and 130ms we see some load still transferredfrom PROn1 to PROn2 because PROn1 remains in conser-vative mode. After 130ms, PROn1 returns to normal modeand the load on PROn2 goes to 0.

By checking the second and third columns, we are able togain an even better understanding on what actually happenswhen jitter arrives. For both j1 and j2, the proactive strategyresponds faster; i.e., n2’s load curve rises earlier and faster.For j2, the proactive strategy responds even faster sincePROn2 is already in conservative mode: PASn2 only startstaking load at 74 ms, 4 ms later after the j2 arrives at PASn1.The major take away here is that INFv is highly responsiveto workload jitter due to its network subsystem.

4.4 Runtime decisionsFinally we evaluate how INFv behaves in 4G, with and with-out additional induced latency, to stress test INFv’s runtimedecisions. Fig. 6 A) and B) show the observed energy con-sumption distribution with and without INFv, for 20 experi-ments using a 1.2MB image [7]. In C) we depict the powerover time for three of these experiments. While the execu-tion without INFv (continuous line), consumed over 2 Wfor most of the experiment time (µ ≈ 11.57s), the execu-tion with INFv (dashed line), is mostly comprised of twospikes in energy consumption. These two spikes representtwo distinct phases: 1) image transmission and 2) retrievingand displaying the results; and are dependent on the currentconnectivity state, e.g., transition to a 4G connected state.In A) and B) we show the power distribution for the 20 ex-periments, with and without INFV, respectively. The powerdistribution in A) has an higher variance but the majorityof the observations are lower than 2W (µ ≈ 1.35W andwithin a 95% confidence interval of 0.139W ) and its ex-ecution is up to 2,8 times faster (µ ≈ 2.3 times) than theexecution without INFv, which results in over 66% energysavings over the 20 executions (idle time excluded). WhileUEs are becoming more powerful, so are commodity pro-cessors and mobile networks, demonstrated by the executionspeed improvements in this experiment compared to the 3Gexperiments (Section 4.2).

Fig. 7 shows the impact of latency on execution time andenergy consumption of FD over 120 executions. The ob-served latency consists of the latency induced on the backendnetwork interface (TC in Fig. 3) and the real 4G latency.7

The energy consumption is always lower when offloading,we see a reduction in the savings from close to 70% lessenergy (no induced latency) to 40% due to higher latency.A major takeaway here has to do with in-network vs. clouddeployment: the overall LTE round-trip time (RTT) for of-floading to a cloud instance is often over 100ms8; quite highcompared to hosting the functionality at the ISP’s RadioAccess Network (RAN) where devices see only 15-45msRTT [45]9. I.e., deploying to the RAN can reduce latencyby 58.9% to 86.7% (over 90ms difference). Since our re-sults indicate that a 70ms variation in latency can incur upto 24.5% and 21.6% increase in the average execution timeand energy consumption, respectively, hosting functionalityin-network brings clear benefits. Further, reducing latencyvia in-network deployment also increases the set of viablecandidate apps for offloading to include those that are par-ticularly latency sensitive (e.g., games).

Finally in Fig. 8 we plot the execution time versus con-sumed energy for the FD app with the INFv offloading deci-

7 Note that while 300ms might be unusual in 4G, it is quite common in 3G.8 We measured a mean latency of 109.4 and 112.2ms from a mobile devicewith LTE in Barcelona, Spain to Amazon EC2 regions with the lowestlatencies (Frankfurt, eu-central-1 and Ireland, eu-west-1).9 we confirmed the lower bound LTE latency values using an USRPtransceiver [1] and a conservative software-based LTE protocol stack [10].

Page 10: Diffusing Your Mobile Apps: Extending In-Network Function ...

●●

● ●

●●

●●

●●

●●

● ●

●●

●●

●●

●●

●●

● ●

●●

●●

● ●

●●

●●

●●

● ●

●●

●●

●●

●●

●● ●

●●

●●

●●

● ●

●●●

●●

● ●●

●●

●●●●●●

● ●

●●●●

●●

● ●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

● ●

●●

●●

●●

● ●

●●

●●●

●●

●●

●●●●●

●●

●●

●●

●●

●●

●●

● ●●

●●

●●●●●●

0

10

20

30

4 8 12 16Execution Time (s)

Ener

gy (W

s)

Execution location ● ●Network Local

Figure 8: Energy consumption vs. execution time of FaceDe-tect using INFv under varying latency.

sion model. The RM keeps a rolling window of observed la-tency (last 3) to the server, which is updated whenever thereis no offloading communication (i.e., no threads paused orpending messages) for > 30s and the screen is on. Therewere 260 experiments over a > 7 hour period (100ms peri-ods). We vary the latency (from 0–600ms, with 50ms steps)30s after each experiment starts. INFv decides whether tooffload the face detection partition based on the connectionproperties at runtime (latency and bandwidth vs. transmittedstate) and the profiling estimates (i.e., energy and executiontime). Therefore, when executed locally, its behavior shouldresemble the experiments in Fig. 6A.

Note that the majority (86.7%) of local execution timesfell within one σ (the dark gray area in the graph) fromthose of the experiments in Fig. 6A, and over 96% of theobserved values within two σ (light gray). Moreover, 99%of local executions’ energy consumptions were within oneσ. There were 4 executions that took longer than the localexperiments, however, they are an artifact of the periodicityof the latency measurements: INFv was not able to detectthe increase in latency prior to making an offloading deci-sion. This is important because such cases can occur dueto changes in connectivity (e.g., 4G to 3G) or ISP servicedegradation. While such impact can be reduced by increas-ing measurement periodicity, the first is already detected bymonitoring changes in the default network interface.

Ultimately, it is clear that, even in the presence of highlatency variance, INFv detected when computation shouldnot be offloaded and energy consumption was greatly re-duced for all offloaded experiments, performing faster thanthe worst local execution 98.5% of the time and faster thanall local executions 93.2% of the time.

4.5 Offloading Popular Libraries and AppsTo evaluate INFv’s support for the most popular libraries andapps, we offloaded an ubiquitous library and performed apartitioning analysis of the top free apps in the GP market.

First, we studied the top 2.5K apps and found that 76.4%of apps use Google Mobile Services (GMS). We chose twoapplications that use a common GMS service – GoogleDrive (GD). The first, QuickEditor [11], is a text editor thatallows users to create, open, and edit text files stored in their

● ●●

●● ●

●●

0

20

40

60

10 20 30Number of Girvan−Newman Clusters (Partitions)

Offl

oada

ble

Cod

e (%

)

app●

Amazon Shop.BitmojiFlashlightFree MusicGoogle Photos

HookedKikLetGoLyftNetflix

PinterestRobloxSlitherSnapchatSolitaire

SoundcloudSpotifySupo SecurityTwitterUber

WhatsappWish Shop.Yahoo MailZedge

Figure 9: Percentage of offloadable code per number ofGirvan-Newman partitions. Black circles represent the op-timal partition given by the louvain algorithm.

GD. The second, QuickPhoto [12], uses the device’s camerato take pictures and upload them to GD. To support bothapps in a device without GMS installed, 26 GMS classeswere offloaded, none of them app specific (code availableat [8]). With our in-network solution the number of extra net-work hops to provide GMS functionality are minimal sinceGD calls already trigger communication which is forwardedthrough the RAN. The network communication overhead isalso quite minimal: around 46, 50, and 10B, respectively, tocreate a class, invoke a method, and receive a response.

Second, to address the concern of how many apps areactually offloadable we inspected the top 24 apps regard-ing INFv’s partitioning and validation mechanisms (Sec-tion 3.2.2). Our first finding was that only 6% of app classesextend UI or hardware related classes. While all other classescould potentially be offloaded, we want to minimize thecommunication between local and offloaded code. To thisend, we used our dynamic analysis platform to execute theapps for 5 minutes each and extract their runtime call graphsto discover valid offloading partitions (i.e., GN communi-ties). Previous work [32] has shown this to be a reasonableinterval to achieve high coverage. Classes that communicateoften are likely to share a purpose (e.g., handle UI interac-tion) and so, building communities based on their communi-cation should separate distinct functionality. In fact, Figure 9shows how increasing the number of partitions increases theamount of offloadable code due to this separation of pur-poses. At 30 GN communities, all but a single app have be-tween 24%-68% of their code suitable for offloading (hun-dreds to thousands of classes). If we use the Louvain [27]algorithm to pick the optimal partitioning (based on mod-ularity), we see find that the median number of partitionsper app is 17 and that their offloadable code ranges from 7to 57% (x ≈ 24%) with only two apps below 10%. Whilethe benefits of offloading such partitions are dependent onthe runtime environment (e.g., state, network connectivity,etc.) these results indicate that our offloading strategy can be

Page 11: Diffusing Your Mobile Apps: Extending In-Network Function ...

applied to more popular and complex apps with huge real-world user bases.

5. Deployment considerationsTo achieve low latency when serving an offloading request,functionality should optimally be already present in nodesand it should perform well under varying load. This raisestwo questions: what is the storage cost of hosting the mostpopular apps? How well does the network subsystem per-form under high-load while reducing the offloading latency?

5.1 Storage requirementsIn this section we give some intuition behind the idea of net-work functionality caching and empirically show its feasibil-ity via a study of over 20K of the most popular apps on theGoogle Play Store in February 2016. As Fig. 10a shows, themarket app packages (apk) are quite small (µ ≈ 15.3MB)even considering the actual install size (µ ≈ 23.9MB).Only a fraction of the apk is actually app functionality –dalvik executable (dex) –, which contains the app classes.For medium/big sized apps (78% of the apps), when ex-tracted from the apk, the dex size is on average 34.1% of theapk size (x ≈ 25.3%). Our dataset accounts for over 81%(≈ 15, 000 apps [63]) of all Google Play downloads and intotal these apps require an aggregated storage of 307 GB(apk size), which is a manageable size.

The large overlap in app functionality can be exploitedto intelligently cache functionality in the network. To un-derstand why and how this is possible, a brief overviewof Android app organization and packaging is necessary.Android apps organize functions into packages which arefurther identified with a hierarchical naming scheme sim-ilar to domain names. Intuitively, the hierarchical namingcould facilitate us in identifying shared functionality acrossapps. Unfortunately, naming in Android can be affected byobfuscation, a security mechanism that remaps functional-ity and package names. It makes it hard, if not impossible,to detect similarities based on simple name comparisons.E.g., a package “com.apple” from app A and a package“com.google” from app B can both be renamed to “a.a”.But, since in Android obfuscation (i.e., Proguard) names areattributed alphabetically, we found that it is possible to de-tect if a package name is obfuscated or not based simplyon name length. We found that 37.5% of apps have po-tentially obfuscated packages with name “a” (at any givendepth), while 82% of the apps have at least one class named“a”. By studying the name distribution with a single char-acter at any given depth, we have found that the major-ity of obfuscated package names have names between “a”and “p” (8% of all packages). Thus, we filtered all packagenames including names with just one character, at any givenlevel. Unfortunately obfuscated class names do not followa similar distribution and such filter would exclude an highnumber of non-obfuscated classes. The remaining packagenames were used to estimate functionality similarity. If the

same package name exists in two different apps we considerthe functionality within this packages to be similar. Obvi-ously, looking at low depth names (N < 3), such as thefirst depth packages (e.g., “a” in “a.b.c”) which containall other packages and functionality, many apps are likelyto share the same name and therefore, most of the func-tionality will be considered similar (false positives). Look-ing deeper into the package hierarchy, however, can greatlyreduce the rate of false positives. Fig. 10b shows the per-centage of unique classes per app based on a comparison ontheir first N package names. The number of unique classesare calculated as the total number of classes in the app mi-nus the number of classes belonging to non-obfuscated pack-age names that also exist in at least one other app. Con-sidering that the package name distribution has µ ≈ 4.7,x ≈ 5.0 and σ ≈ 1.6, and that most package names have adepth between 4 (Q1) and 6 (Q3), even if we do a conser-vative comparison of packages based on their first 5 namedepths (50th percentile), we can see that only 47% (mean)of apps’ classes are unique. Note that while higher values(N ≥ 8) reduce false positives, they also increase the num-ber of false negatives as classes within packages with smallerdepths are considered as unique. For a depth of 4, which islikely to include the name of the app and respective devel-oper (e.g., “com.facebook.katana.app”), 75% (median)of apps’ functionality is common with at least one other app.The analysis thus indicates that there is a substantial app’sfunctionality overlap in the Android ecosystem.

Extracting the app classes (classes.dex), the storage re-quirements to host over 81% of the most downloaded apps,are already reduced by 74% (≈ 80GB). If common function-ality is co-located, the total reduction can be up to 93.5%(< 20GB, based on the 4th depth median overlap). Whileour app analysis platform requires at least the full apk filesfor analysis, the class overlap provides a unique opportunityfor deployment in a modern ISP network, allowing INFv toexploit the network topology and ensure that functionality isavailable as close to users as possible.

5.2 Scalability to WorkloadIn this section we perform a large network simulation usinga realistic ISP topology (Exodus [59]) with Icarus [56]. Weuse a Poisson request stream with λ = 1000/s for the arrivalrate; increasing the request rate introduces more load to thenetwork. To simplify the presentation, we assume CPU is thefirst bottleneck in the system for computationally intensiveapps and all experiments are performed >50 times to ensurethe reported results are representative.

Fig. 11 shows the results of using three strategies (onefor each row) with three workloads (one for each column).There are 375 nodes in the network and we randomly select100 nodes of degree one as access points to receive user re-quests. The average load of each node is normalized by itsCPU capacity and only the top 50 heaviest loads are pre-sented in a decreasing order. By examining the first column,

Page 12: Diffusing Your Mobile Apps: Extending In-Network Function ...

0.00

0.25

0.50

0.75

1.00

1e−02 1e+00 1e+02

Size (MB)

CD

F

APK

DEX

SMALI

(a) CDF of package (apk), dalvik executable(dex), and disassembled dex (smali) sizes.

●●

●●

●●●

●●

●●●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

●●●

●●

●●

●●

●●●

●●

●●●

●●●●●

●●

●●●

●●●

●●

●●●

●●●

●●●●●●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●●●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●●

●●●

●●

●●

●●

●●

●●●●

●●

●●

●●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●●

●●●

●●

●●

●●

●●

●●

●●●●●●

●●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●●

●●

●●●●

●●

●●●

●●

●●

●●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●●

●●●●

●●

●●

●●

●●●

●●

●●

●●●●

●●●●●

●●

●●●●●●

●●●●●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●●●

●●

●●

●●

●●●●

●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●●

●●●●

●●

●●

●●

●●

●●●●

●●●●

●●

●●●

●●●●●●●

●●

●●

●●●

●●●●

●●

●●

●●●

●●●

●●●●

●●

●●

●●●●

●●●

●●●

●●●

●●

●●●

●●

●●

●●●●●●●

●●●

●●●

●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●●●

●●

●●●

●●●

●●●●●

●●

●●●

●●

●●

●●●●

●●

●●●●●

●●

●●●●●

●●

●●

●●

●●●

●●●

●●●●

●●

●●

●●

●●●●

●●●●

●●

●●

●●●

●●

●●

●●●●

●●

●●

●●

●●●

●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●●●●

●●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●●●●

●●

●●

●●

●●●●●

●●●●

●●●●

●●

●●

●●

●●

●●

●●

●●●●

●●●

●●●

●●

●●●

●●●●●●

●●

●●●

●●

●●

●●●

●●●●●●●

●●

●●●●●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●●

●●●

●●●●

●●●

●●

●●

●●

●●

●●

●●●●●●●●

●●●●

●●●

●●●●

●●

●●

●●

●●

●●●

●●●

●●

●●●●●

●●

●●●●

●●

●●●●●●●●●

●●

●●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●●●

●●

●●

●●

●●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●●●

●●●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●●●

●●●●●●●

●●

●●●●

●●●

●●

●●●

●●●●

●●

●●

●●●

●●

●●●

●●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●●●●●●●

●●●

●●●●

●●●

●●

●●

●●●

●●

●●●●

●●●●●

●●

●●●●

●●

●●●

●●●

●●

●●●

●●

●●●

●●●●●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●●●●

●●

●●

●●●

●●●

●●

●●

●●

●●●

●●●

●●

●●●

●●

●●●

●●

●●●

●●

●●●●

●●●

●●●●●●

●●●

●●●

●●●

●●●●

●●

●●●●●

●●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●●

●●●●●●

●●

●●●●

●●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●●●●

●●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●●

●●●●●

●●

●●●

●●

●●

●●●

●●

●●●

●●

●●●●●●

●●

●●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

●●

●●

●●●

●●●

●●

●●●

●●●●

●●●

●●

●●

●●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●

●●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●●●

●●

●●●

●●

●●

●●●

●●

●●

●●●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●

●●

●●●●●

●●

●●●●●

●●

●●

●●

●●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●●

●●●

●●

●●

●●

●●●

●●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●●●

●●

●●

●●●

●●

●●●

●●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●

●●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●●●

●●

●●

●●

●●

●●●●●

●●

●●●●

●●

●●

●●●

●●

●●●●

●●●

●●

●●

●●

●●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●●

●●●

●●

●●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●●●●●●●

●●

●●●●●

●●

●●●●●

●●

●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●●●

●●

●●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●●

●●

●●●

●●

●●

●●

●●

●●●

●●●

●●

●●

●●

●●

●●

●●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●

●●

●●

●●

●●●●●

●●

●●●●●●●

●●●●

●●

●●

●●

●●

●●

●●

●●

●●●●

●●●●

●●●●

●●●●●●●●●●

●●●

●●●●

●●●●

●●●

●●●

●●●●

●●●

●●

●●

●●●●●●●●●

●●

●●

●●

●●●

●●

●●

●●●●●

●●

●●

●●

●●●

●●

●●●●●

●●●

●●●

●●

●●●●●

●●●

●●

●●

●●

●●

●●●●●●●●●●●●

●●●●●

●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●

●●

●●

●●●●

●●●

●●●

●●

●●

●●●●●

●●●●●●●●

●●

●●●●●●●●●●●●

●●●●●●●

●●

●●

●●

●●●●●●●

●●●●●●●●

●●●●●●●●●

●●●

●●●●●●

●●●●●●●

●●●●●●

●●

●●

●●●●●

●●

●●●●●●●●●

●●

●●●●●

●●●●●●

●●●

●●

●●●●

●●

●●●●●

●●●●●

●●

●●●●●●

●●●●●●●

●●

●●●●●●●●●●●

●●●●●●●

●●●●●

●●●●●●●●

●●●●●●

●●

●●

●●

●●●

●●●●●●●●

●●●●

●●●●

●●●●●●●

●●

●●

●●●●●●●●●

●●●●

●●●●

●●●●●●●●

●●●

●●

●●

●●

●●●

●●●

●●●●●

●●

●●●

●●●●●●●

●●●●●●●

●●●●●●●

●●●●

●●●

●●●

●●

●●

●●●

●●●

●●●

●●●●

●●●

●●●●●●

●●●●●

●●●●

●●

●●●

●●●●●

●●

●●●●●

●●●

●●

●●

●●

●●

●●●●

●●●●

●●●

●●●

●●●

●●●

●●●●

●●

●●●

●●●●●●●●

●●●●●●

●●●●●●●●●

●●●●●●●●●●●●●●

●●●

●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●

●●●●●●

●●●●●●●●●●●●●●

●●●●●

●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●

●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●

●●●●●●●

●●●●●●●●

●●●●●●

●●●

●●

●●

●●●●●●

●●●●

●●●●●

●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●

●●●●●●●●●●●●●●●●●●

●●●

●●●●●●●●●●●●●●●●●●●●

●●●●●●●

●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●

●●●●●●●●●●●●●●●●●

●●●

●●●●●●●●

0

25

50

75

100

1 2 3 4 5 6 7 8 9 10Package Depth

% o

f uni

que

clas

ses

p/ap

p

(b) Percentage of unique classes per app as afunction of name depth used for comparison.

●●

●●●●●●●●●●●●●

●●

●●●● ●

●●●●●●

●●

●●●●●●●●

●●●●

●●

●●●

●●●

●● ●

●●●●●

●●

●●●●

●●

●●

●●●●●●●●●●

●●

●●●●

●●●

●●●●●●

●●●

●●

0

5

10

15

20

25

100 1K 10K 100K 1M 10M 100M 1BDownloads

Cla

sses

(in

thou

sand

s)

(c) Number of classes per app as a function ofapp popularity.

Figure 10: Study of over 20K Google Play apps regarding their size, structure and uniqueness.

10 20 30 40

Non

e

0

0.2

0.4

0.6

0.8

1= = 0.0631? = 18.16A = 0

1 # 6

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.2017? = 17.82A = 0.2009

4 # 6

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.2305? = 21.15A = 0.5434

8 # 6

10 20 30 40

Pass

ive

0

0.2

0.4

0.6

0.8

1= = 0.0631? = 18.16A = 0

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.2228? = 20.82A = 0.1173

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.3202? = 25.74A = 0.3657

10 20 30 40

Proa

ctiv

e

0

0.2

0.4

0.6

0.8

1= = 0.0631? = 18.16A = 0

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.2528? = 19.36A = 0

10 20 30 400

0.2

0.4

0.6

0.8

1= = 0.5047? = 22.28A = 0

Figure 11: Comparison of three strategies (rows) with in-creasing load (columns). x-axis is node index and y-axis isload. Top 50 nodes of the heaviest load are sorted in decreas-ing order and presented. Notations: τ : average load; φ: aver-age latency (in ms); ψ: ratio of dropped requests.

we can see all three strategies have identical behaviors whenthe network is underutilized with a workload of λ. The heav-iest loaded node uses only about 60% of its total capacity.However, as we increase the load to 4λ and 8λ, the threestrategies exhibit quite different behavior. The experimentwithout a control strategy (“none”) at the first row, the fig-ures remain the similar shape. Since no load is distributedand a node simply drops all requests when being overloaded,it leads to over 54% drop rate with load of 8λ.

For passive control (second row), we can see both theheads and tails are fatter than “none” control, indicating thatmore load is absorbed by the network and distributed ondifferent routers. This can also be verified by checking theaverage load in the figure: given a load of 8λ, passive controlincreases the average load of the network from 0.2305 to0.3202 compared to using “none” control. However, thereis still over 36% requests dropped at the last hop router.

This can be explained by the well-known small-world effectwhich makes the network diameter short, so there are onlylimited resources along a random path.

Among all the experiments, a network with proactivecontrol always absorbs all the load, leading to the highest av-erage load in the network which further indicates the highestutilization rate. As the workload increases from λ to 8λ, av-erage load also increases accordingly with the same factor.One very distinct characteristic that can be easily noticed inthe last two figures on the third row is that the load distri-bution has a very heavy tail. This is attributed to the proac-tive strategy’s capability of offloading to its neighbors. It isalso worth pointing out that we only measured the latencyof those successfully executed functions, which further ex-plains why “none” control has the smallest latency, since of-floaded functionality gets executed immediately at an edgerouter connected to a client, but more than half the requestsare simply dropped and not counted at all. Comparing tothe passive strategy, the proactive strategy achieves lower la-tency. Further investigation on other ISP topologies showsthat latency reduction improves with larger networks.

6. Conclusion & Future workBattery is a huge constraint for mobile devices and the evergrowing demands of computation on limited capacity areunlikely to disappear any time soon. Meanwhile, in-networkstorage and computation resources are growing. We pro-posed INFv to exploit in-network resources for mobile func-tion offloading. We described its data-driven design andimplementation based on a large scale analysis of a realapp market. Our evaluation demonstrates that INFv’s non-intrusive offloading technique can significantly improve mo-bile device’s performance (up to 6.9x energy reduction and4x faster) and effectively execute functionality in the net-work while reducing latency. Our analysis shows the po-tential for functionality caching and popular app offloading,while also providing interesting insights into Android apps’obfuscation and composition. INFv is a working system andmany of its components are open-sourced [14, 15, 17].

There are some limitations and caveats which deserve fur-ther investigation in the future. First, INFv requires attention

Page 13: Diffusing Your Mobile Apps: Extending In-Network Function ...

to the security and privacy of communication and offloadedfunctionality. While it provides isolation and detects the useof critical OS APIs, in the future we will consider techniquesfor detecting vulnerabilities/malware [49, 53] and access toprivacy sensitive information [39]. Although it does not re-quire a custom OS, a one-time root is required, which canbe disabled after install. If deployed by an ISP, it can be pre-installed on devices or installed in stores. For other scenar-ios, either root would be required or, an existing vulnera-bility could be leveraged to install INFv and secure the de-vice [51].

Second, UI automation might not cover all app code andits generated state might not be representative of real user’sinput. A significant amount of work exists on improvingcoverage [23, 32, 47, 48] and we are looking to furtherimprove our dynamic analysis by exploiting crowdsourcingplatforms [34] to test apps with real users. Additionally, aniOS implementation should be possible using similar inter-ception mechanisms [4] and static analysis can be accom-plished by dumping the decrypted apps from memory [6].We also plan to explore different interception techniques tobetter support native code [4]. Finally, we are working to de-ploy a small-scale real-user test in the coming year to gainvaluable feedback to further improve INFv.

References[1] Ub210. URL https://www.ettus.com/product/

details/UB210-KIT.

[2] Android dynamic binary instrumentation. URL https://

github.com/crmulliner/adbi.

[3] Android apktool. URL https://code.google.com/p/

android-apktool/.

[4] Cydia Substrate. URL http://www.cydiasubstrate.

com/.

[5] Dexguard. URL https://www.guardsquare.com/

dexguard.

[6] Dumpdecrypted. URL https://github.com/

stefanesser/dumpdecrypted.

[7] At&t - the database of faces. URL http://www.cl.cam.ac.

uk/research/dtg/attarchive/facesataglance.html.

[8] Gms replacement for google drive. URL https://github.

com/4knahs/gmsreplace.

[9] UI/Application Exerciser Monkey | Android Develop-ers. URL http://developer.android.com/intl/es/

tools/help/monkey.html.

[10] Open air interface. URL http://www.openairinterface.

org/.

[11] Quickeditor, . URL https://github.com/googledrive/

android-quickeditor.

[12] Quickphoto, . URL https://github.com/googledrive/

android-quickstart.

[13] Xposed framework. URL http://repo.xposed.info/.

[14] Static analysis tool., 2016. URL https://bitbucket.org/

aknahs/droidbroker.

[15] Java call graph structure., 2016. URL https://bitbucket.

org/aknahs/droidsmali.

[16] The Database of Faces, 2016. URL http://www.cl.cam.

ac.uk/research/dtg/attarchive/facedatabase.

html.

[17] Freelinpack, 2016. URL https://bitbucket.org/

aknahs/freelinpack.

[18] Objenesis : Object instantiation, 2016. URL http://

objenesis.org/.

[19] Hp opennfv and intel onp, 2016. URLhttp://www.intel.com/content/dam/www/

public/us/en/documents/white-papers/

hp-onp-packet-processing-benchmark-paper.pdf.

[20] S. E. Abdullahi and G. A. Ringwood. Garbage Collecting theInternet: A Survey of Distributed Garbage Collection. ACMComput. Surv., 30(3):330–373, Sept. 1998. ISSN 0360-0300..

[21] Alcatel-Lucent and China Mobile conduct industry-firstlive field trial of a virtualized radio access network.https://www.alcatel-lucent.com/press/2015/alcatel-lucent-and-china-mobile-conduct-industry-first-live-field-trial-virtualized-radio-access, 2015.

[22] M. Almeida, M. Bilal, J. Blackburn, and K. Papagian-naki. An Empirical Study of Android Alarm Usage forApplication Scheduling. In Passive and Active Measure-ment, pages 373–384. Springer International Publishing,2016. URL http://link.springer.com/chapter/10.

1007/978-3-319-30505-9_28.

[23] M. Almeida, M. Bilal, A. Finamore, I. Leontiadis, Y. Grunen-berger, M. Varvello, and J. Blackburn. Chimp: Crowdsourc-ing human inputs for mobile phones. In Proceedings of the2018 World Wide Web Conference, WWW ’18, pages 45–54,Republic and Canton of Geneva, Switzerland, 2018. Inter-national World Wide Web Conferences Steering Committee.ISBN 978-1-4503-5639-8. . URL https://doi.org/10.

1145/3178876.3186035.

[24] G. Altekar, I. Bagrak, P. Burstein, and A. Schultz. OPUS:Online Patches and Updates for Security. In Proceedings ofthe 14th Conference on USENIX Security Symposium - Vol-ume 14, SSYM’05, pages 19–19, Berkeley, CA, USA, 2005.USENIX Association.

[25] AT&T Domain 2.0 Vision White Paper.https://www.att.com/common/about us/pdf/at&t2013.

[26] A. Aucinas, N. Vallina-Rodriguez, Y. Grunenberger, V. Er-ramilli, K. Papagiannaki, J. Crowcroft, and D. Wetherall.Staying online while mobile: The hidden costs. In Proceed-ings of the Ninth ACM Conference on Emerging NetworkingExperiments and Technologies, CoNEXT ’13, pages 315–320,New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2101-3.

[27] V. D. Blondel, J.-L. Guillaume, R. Lambiotte, and E. Lefeb-vre. Fast unfolding of communities in large networks. Jour-nal of statistical mechanics: theory and experiment, 2008(10):P10008, 2008.

[28] P. buffers. https://developers.google.com/protocol-buffers/,2016.

Page 14: Diffusing Your Mobile Apps: Extending In-Network Function ...

[29] Carta Blanco: NFV at Telefonica.http://telecoms.com/interview/carta-blanco-nfv-in-telefonica/, 2014.

[30] H. Chen, J. Yu, R. Chen, B. Zang, and P.-C. Yew. POLUS:A POwerful Live Updating System. In 29th InternationalConference on Software Engineering, 2007. ICSE 2007, pages271–281, May 2007. .

[31] H.-Y. Chen, Y.-H. Lin, and C.-M. Cheng. COCA: Computa-tion Offload to Clouds Using AOP. In 2012 12th IEEE/ACMInternational Symposium on Cluster, Cloud and Grid Com-puting (CCGrid), pages 466–473, May 2012. .

[32] S. R. Choudhary, A. Gorla, and A. Orso. Automated Test InputGeneration for Android: Are We There Yet? In 2015 30thIEEE/ACM International Conference on Automated SoftwareEngineering (ASE), pages 429–440, Nov. 2015. .

[33] B.-G. Chun, S. Ihm, P. Maniatis, M. Naik, and A. Patti.CloneCloud: Elastic Execution Between Mobile Device andCloud. In Proceedings of the Sixth Conference on ComputerSystems, EuroSys ’11, pages 301–314, New York, NY, USA,2011. ACM. ISBN 978-1-4503-0634-8.

[34] C. C. company. https://www.crowdflower.com/, 2015.

[35] M. E. Computing. https://goo.gl/rgui0a, 2015.

[36] E. Cuervo, A. Balasubramanian, D.-k. Cho, A. Wolman,S. Saroiu, R. Chandra, and P. Bahl. MAUI: Making Smart-phones Last Longer with Code Offload. In Proceedings ofthe 8th International Conference on Mobile Systems, Appli-cations, and Services, MobiSys ’10, pages 49–62, New York,NY, USA, 2010. ACM. ISBN 978-1-60558-985-5.

[37] A. Desnos. Android: Static Analysis Using Similarity Dis-tance. In 2012 45th Hawaii International Conference on Sys-tem Science (HICSS), pages 5394–5403, Jan. 2012. .

[38] DOCOMO Partners with Ericsson, Fujitsu and NEC for NFVDeployment. https://goo.gl/mmqpuc, 2015.

[39] W. Enck, P. Gilbert, S. Han, V. Tendulkar, B.-G. Chun, L. P.Cox, J. Jung, P. McDaniel, and A. N. Sheth. TaintDroid:An Information-Flow Tracking System for Realtime PrivacyMonitoring on Smartphones. ACM Trans. Comput. Syst., 32(2):5:1–5:29, June 2014. ISSN 0734-2071. .

[40] Ericsson and Vodafone deploy first cloud-based VoLTE.http://www.ericsson.com/news/1993653, 2014.

[41] M. Girvan and M. E. J. Newman. Community structure insocial and biological networks. Proceedings of the NationalAcademy of Sciences, 99(12):7821–7826, June 2002. ISSN0027-8424, 1091-6490. . URL http://www.pnas.org/

content/99/12/7821.

[42] M. S. Gordon, D. A. Jamshidi, S. Mahlke, Z. M. Mao, andX. Chen. COMET: Code Offload by Migrating ExecutionTransparently. In Proceedings of the 10th USENIX Con-ference on Operating Systems Design and Implementation,OSDI’12, pages 93–106, Berkeley, CA, USA, 2012. USENIXAssociation. ISBN 978-1-931971-96-6.

[43] R. Kemp, N. Palmer, T. Kielmann, and H. Bal. Cuckoo:A Computation Offloading Framework for Smartphones. InM. Gris and G. Yang, editors, Mobile Computing, Applica-tions, and Services, number 76 in Lecture Notes of the Insti-tute for Computer Sciences, Social Informatics and Telecom-

munications Engineering, pages 59–79. Springer Berlin Hei-delberg, Oct. 2010. ISBN 978-3-642-29335-1 978-3-642-29336-8. URL http://link.springer.com/chapter/

10.1007/978-3-642-29336-8_4.

[44] S. Kosta, A. Aucinas, P. Hui, R. Mortier, and X. Zhang.ThinkAir: Dynamic resource allocation and parallel executionin the cloud for mobile code offloading. In 2012 ProceedingsIEEE INFOCOM, pages 945–953, Mar. 2012. .

[45] M. Laner, P. Svoboda, P. Romirer-Maierhofer, N. Nikaein,F. Ricciato, and M. Rupp. A comparison between one-waydelays in operating HSPA and LTE networks. In 2012 10thInternational Symposium on Modeling and Optimization inMobile, Ad Hoc and Wireless Networks (WiOpt), pages 286–292, May 2012.

[46] M. Linares-Vsquez, A. Holtzhauer, C. Bernal-Crdenas, andD. Poshyvanyk. Revisiting Android Reuse Studies in the Con-text of Code Obfuscation and Library Usages. In Proceedingsof the 11th Working Conference on Mining Software Reposito-ries, MSR 2014, pages 242–251, New York, NY, USA, 2014.ACM. ISBN 978-1-4503-2863-0. .

[47] A. Machiry, R. Tahiliani, and M. Naik. Dynodroid: An InputGeneration System for Android Apps. In Proceedings of the2013 9th Joint Meeting on Foundations of Software Engineer-ing, ESEC/FSE 2013, pages 224–234, New York, NY, USA,2013. ACM. ISBN 978-1-4503-2237-9. .

[48] R. Mahmood, N. Mirzaei, and S. Malek. EvoDroid: Seg-mented Evolutionary Testing of Android Apps. In Proceed-ings of the 22Nd ACM SIGSOFT International Symposium onFoundations of Software Engineering, FSE 2014, pages 599–609, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-3056-5. .

[49] E. Mariconti, L. Onwuzurike, P. Andriotis, E. De Cristofaro,G. Ross, and G. Stringhini. Mamadroid: Detecting androidmalware by building markov chains of behavioral models.arXiv preprint arXiv:1612.04433, 2016.

[50] I. J. Mojica, B. Adams, M. Nagappan, S. Dienst, T. Berger,and A. E. Hassan. A Large-Scale Empirical Study on SoftwareReuse in Mobile Apps. IEEE Software, 31(2):78–86, Mar.2014. ISSN 0740-7459. .

[51] C. Mulliner, J. Oberheide, W. Robertson, and E. Kirda. Patch-Droid: Scalable Third-party Security Patches for Android De-vices. In Proceedings of the 29th Annual Computer SecurityApplications Conference, ACSAC ’13, pages 259–268, NewYork, NY, USA, 2013. ACM. ISBN 978-1-4503-2015-3.

[52] A. J. Oliner, A. P. Iyer, I. Stoica, E. Lagerspetz, andS. Tarkoma. Carat: Collaborative Energy Diagnosis for Mo-bile Devices. In Proceedings of the 11th ACM Conferenceon Embedded Networked Sensor Systems, SenSys ’13, pages10:1–10:14, New York, NY, USA, 2013. ACM. ISBN 978-1-4503-2027-6.

[53] L. Onwuzurike, M. Almeida, E. Mariconti, J. Blackburn,G. Stringhini, and E. De Cristofaro. A family of droids-android malware detection via behavioral modeling: Static vsdynamic analysis. In 2018 16th Annual Conference on Pri-vacy, Security and Trust (PST), pages 1–10, Aug 2018. .

[54] M. Patel, B. Naughton, C. Chan, N. Sprecher, S. Abeta,A. Neal, et al. Mobile-edge computing introductory techni-

Page 15: Diffusing Your Mobile Apps: Extending In-Network Function ...

cal white paper. White Paper, Mobile-edge Computing (MEC)industry initiative, 2014.

[55] I. J. M. Ruiz, M. Nagappan, B. Adams, and A. E. Hassan.Understanding reuse in the Android Market. In 2012 IEEE20th International Conference on Program Comprehension(ICPC), pages 113–122, June 2012. .

[56] L. Saino, I. Psaras, and G. Pavlou. Icarus: a caching simulatorfor information centric networking (icn). In Proceedings ofthe 7th International ICST Conference on Simulation Toolsand Techniques, SIMUTOOLS ’14, ICST, Brussels, Belgium,Belgium, 2014. ICST.

[57] M. Satyanarayanan, P. Bahl, R. Caceres, and N. Davies. TheCase for VM-Based Cloudlets in Mobile Computing. IEEEPervasive Computing, 8(4):14–23, Oct. 2009. ISSN 1536-1268. .

[58] C. Shi, K. Habak, P. Pandurangan, M. Ammar, M. Naik, andE. Zegura. Cosmos: Computation offloading as a service formobile devices. In Proceedings of the 15th ACM InternationalSymposium on Mobile Ad Hoc Networking and Computing,MobiHoc ’14, pages 287–296, New York, NY, USA, 2014.ACM. ISBN 978-1-4503-2620-9.

[59] N. Spring, R. Mahajan, and D. Wetherall. Measuring ISPTopologies with Rocketfuel. In Proceedings of the 2002Conference on Applications, Technologies, Architectures, andProtocols for Computer Communications, SIGCOMM ’02,pages 133–145, New York, NY, USA, 2002. ACM. ISBN 978-1-58113-570-1. .

[60] Telefonica selects Ericsson for global UNICA program.http://www.ericsson.com/news/1988285, 2016.

[61] Telefonicas view on virtualized mo-bile networks. http://www.ict-ijoin.eu/wp-content/uploads/2015/03/6b berberana telefonica.pdf, 2015.

[62] L. I. A. via Home Node B.http://go.radisys.com/rs/radisys/images/paper-femto-lipa.pdf,2011.

[63] N. Viennot, E. Garcia, and J. Nieh. A measurement study ofgoogle play. SIGMETRICS Perform. Eval. Rev., 42(1):221–233, June 2014. ISSN 0163-5999.

[64] H. Wang, Y. Guo, Z. Ma, and X. Chen. WuKong: A Scalableand Accurate Two-phase Approach to Android App Clone De-tection. In Proceedings of the 2015 International Symposiumon Software Testing and Analysis, ISSTA 2015, pages 71–82,New York, NY, USA, 2015. ACM. ISBN 978-1-4503-3620-8.

[65] L. Wang, M. Almeida, J. Blackburn, and J. Crowcroft. C3po:Computation congestion control (proactive). In Proceedingsof the 3rd ACM Conference on Information-Centric Network-ing, ACM-ICN ’16, pages 231–236, New York, NY, USA,2016. ACM. ISBN 978-1-4503-4467-8. . URL http:

//doi.acm.org/10.1145/2984356.2988518.

[66] L. Zhang, B. Tiwana, Z. Qian, Z. Wang, R. P. Dick,Z. M. Mao, and L. Yang. Accurate Online Power Es-timation and Automatic Battery Behavior Based PowerModel Generation for Smartphones. In Proceedings of theEighth IEEE/ACM/IFIP International Conference on Hard-ware/Software Codesign and System Synthesis, CODES/ISSS’10, pages 105–114, New York, NY, USA, 2010. ACM. ISBN978-1-60558-905-3. .

[67] Y. Zhang, G. Huang, X. Liu, W. Zhang, H. Mei, and S. Yang.Refactoring Android Java Code for On-demand ComputationOffloading. In Proceedings of the ACM International Con-ference on Object Oriented Programming Systems Languagesand Applications, OOPSLA ’12, pages 233–248, New York,NY, USA, 2012. ACM. ISBN 978-1-4503-1561-6.