Lecture 10 · Mobile and edge computing: constraints, offloading, cloudlets and adaptation

Distributed Systems · Lecture 10。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: CMU 15-440/640 Spring 2026, learning outcome “exploiting low bandwidth to improve availability” and the caching unit (Part II). Readings (optional, course list):

  • M. Satyanarayanan, Fundamental Challenges in Mobile Computing (PODC 1996);
  • M. Satyanarayanan, The Emergence of Edge Computing (IEEE Computer, January 2017);
  • A. Singla, B. Chandrasekaran, P. B. Godfrey and B. Maggs, The Internet at the Speed of Light (HotNets 2014), again.

Problem set: PS2’s caching questions may involve mobile scenarios; the scenarios and numbers here are different. Sources: the readings above. Background:

  • B. Noble et al., Agile Application-Aware Adaptation for Mobility (SOSP 1997; Odyssey);
  • J. Flinn and M. Satyanarayanan, Energy-Aware Adaptation for Mobile Applications (SOSP 1999);
  • L. Mummert, M. Ebling and M. Satyanarayanan, Exploiting Weak Connectivity for Mobile File Access (SOSP 1995);
  • M. Satyanarayanan et al., The Case for VM-Based Cloudlets in Mobile Computing (IEEE Pervasive Computing 2009);
  • T.-Y. Huang et al., A Buffer-Based Approach to Rate Adaptation (SIGCOMM 2014).

The slides are not public; this is not a transcript. Numbers from papers are labelled as such. Every other number comes from code/lecture10/, run on the author’s machine (Apple M4 Pro, macOS, Python 3.13 and 3.9). Device, radio and network parameters in the code are stated assumptions, of the right order of magnitude, not measurements. Code: code/lecture10/. Reading time: ~80 minutes, plus ~5 to run the demos.


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. State the four constraints of mobility and explain why they force adaptation: application-transparent vs application-aware.
  2. Turn a latency budget into a maximum distance to the server and a number of sites, and explain why the first hop and the tail dominate.
  3. Decide whether to offload a computation to a cloudlet or a cloud, by time and by energy, including the cellular radio’s tail energy.
  4. Explain cloudlets / edge computing: what they are, their four benefits, and their limits (capacity, management, security).
  5. Design an adaptive-fidelity policy and reason about agility vs stability.
  6. Explain weakly connected operation: trickle reintegration, the aging window, log optimizations, and keeping background traffic out of the user’s way.

0.2 Prerequisites and scope

  • Prerequisites:
    • Lecture 1: the speed-of-light floor;
    • Lecture 2: latency vs bandwidth, BDP;
    • Lecture 5: AFS, whole-file caching;
    • Lectures 7–9: consistency, hoarding as prefetching, buffer bloat, priorities.
  • Scope: one mobile client and the infrastructure near and far from it. Disconnected operation and conflict resolution in Coda are Lecture 22. Queueing theory for sizing servers is Lecture 11; control loops are Lecture 12.

0.3 Section → code map

SectionIdeaDemo in code/lecture10/
§3latency budgets, radius, sites, the tail01_latency_budget.py
§4offloading: time and energy02_offload_or_not.py
§5cloudlet vs cloud under load and failure; edge analytics03_edge_vs_cloud.py
§6adaptive fidelity; agility vs stability; energy goals04_adaptive_fidelity.py
§7weak connectivity: trickle reintegration05_weak_connectivity.py
allmodels with stated assumptionsmobility.py

0.4 Notation

  • cc = speed of light in vacuum ≈ 300 km/ms. Inflation = how much slower the real network is than light along the great circle (Singla et al.’s definition): 1.47 for a perfect fiber, 2.3 for the median router-level path, 3.2 for the median minimum ping (paper’s numbers).
  • Device speeds are relative to a phone (1.0); task demands are in phone-seconds.
  • Fidelity = the quality level an application chooses, measured here as a bitrate.

1. What is different about mobile computing?

1.1 Four constraints

Satyanarayanan’s 1996 paper asks whether mobile computing is just a small distributed system with radios, and answers that it is not. Mobility imposes four constraints that are intrinsic — not artifacts of today’s technology:

  1. Mobile devices are resource-poor compared with static ones. For a given cost and level of technology, weight, power, size and ergonomics cost computing capacity. Phones keep getting faster, and so do servers; the gap remains.
  2. Mobility is hazardous. Devices are lost, stolen, dropped and broken far more often than machines in locked rooms. Data that exists only on the device is at risk.
  3. Connectivity varies widely in bandwidth, latency and reliability: good Wi-Fi in one building, a weak cell outside, nothing in a tunnel.
  4. Energy is finite. Every component, from radio to screen to CPU, draws on a battery, and power must be managed at every level.

1.2 Autonomy vs interdependence, and adaptation

Every distributed system balances autonomy (do it yourself) against interdependence (rely on others). Mobility pulls both ways at once:

  • weak devices and their exposure to theft argue for relying on servers;
  • unreliable networks and the battery argue for self-reliance.

No fixed balance works, because the circumstances keep changing. The client must adapt, shifting responsibilities between itself and the servers as conditions change.

The 1996 paper lays out a range of adaptation strategies:

  • Laissez-faire: each application adapts on its own. No system support, but no arbitration between applications either, and each one reinvents the machinery.
  • Application-transparent: the system adapts and applications are unchanged. Coda is the example (Lecture 22): disconnected operation, hoarding, trickle reintegration, all under an unmodified Unix file API.
  • Application-aware (in between): the system monitors resources and arbitrates; each application decides what adapting means for it — lower video resolution, coarser maps, fewer search results. Odyssey is the example.

1.3 The extended client-server model

Mobility also blurs the classic roles. A weak client sometimes asks a server to do work that clients normally do (offloading, §4). A disconnected client sometimes acts as its own server (emulation in Coda). These are short-term deviations for performance and availability. For administration and security, the roles stay as they were.

1.4 What earlier lectures look like on the move

  • Caching (Lectures 5–8) becomes an availability mechanism, not just a performance one. The 1996 paper also notes that the miss ratio becomes a poor quality metric: one miss during a disconnection can be far worse than many misses on a LAN.
  • Prefetching becomes hoarding: choosing what to carry before disconnecting (Lecture 9 §5.3).
  • Consistency (Lecture 7) becomes expensive when validation takes a slow round trip. The paper proposes semantic callbacks: the client caches data satisfying a costly predicate P; the server tracks a cheaper predicate Q that implies P and notifies the client when Q becomes false. Coda’s version is per-volume version stamps that validate a whole subtree at once after a reconnection.

2. Why proximity matters (and the edge)

Cloud computing centralizes, for economies of scale and to avoid capital expenditure. Mobile and Internet-of-Things applications pull the other way. Satyanarayanan’s 2017 paper describes edge computing: substantial compute and storage (cloudlets, micro data centers, fog nodes) placed at the Internet’s edge, close to mobile devices and sensors. It traces a lineage:

  • CDNs (late 1990s) placed caches near users.
  • In 1997, Noble and colleagues offloaded speech recognition from a weak mobile device to a nearby server.
  • In 1999, Flinn and Satyanarayanan extended offloading to save battery.
  • In 2001, “cyber foraging” named the general idea of using nearby infrastructure to amplify a mobile device.
  • The cloud then became the obvious thing to offload to (Siri, Google’s speech recognition). But consolidation means distance: the paper cites a measured average round trip of 74 ms from 260 vantage points to their optimal Amazon EC2 region (Li et al. 2010; paper’s number), plus the wireless first hop and the jitter of a multi-hop path.
  • In 2009, the cloudlet paper proposed a two-level architecture. Level one is the unmodified cloud. Level two is dispersed cloudlets holding only soft state cached from the cloud, which makes them easy to manage despite their dispersal.

The paper lists four ways proximity helps:

  1. Highly responsive services: low latency, high bandwidth and low jitter for offloaded computation (AR, VR, cognitive assistance).
  2. Scalability via edge analytics: analyze high-bandwidth sensor data (video) at the edge and send only the results.
  3. Privacy-policy enforcement: a cloudlet inside the owner’s trust domain can denature sensor data (blur faces, aggregate readings) before it leaves.
  4. Masking cloud outages: a nearby fallback service survives failures of the wide-area network or the cloud.

The next sections put numbers on the first, second and fourth.


3. Latency budgets: how close is close enough?

3.1 Budgets

Humans are fast at perception, and slow responses break interaction. The edge paper cites perception figures:

  • face recognition takes people 370–620 ms;
  • speech recognition of short phrases 300–450 ms;
  • telling that a sound is a human voice about 4 ms;
  • head-tracked VR needs end-to-end latency below 16 ms for perceptual stability.

It names “a few tens of milliseconds” as a safe and achievable goal. A budget pays for:

  • the wireless first hop;
  • the wide-area round trip, at least 2d×inflation/c2 d \times \text{inflation} / c for a server dd km away;
  • the processing at the server.

Solving for dd gives the radius within which the server must sit.

3.2 The radius

01_latency_budget.py Part A, with assumed processing times and first-hop round trips (Wi-Fi 3 ms, low-latency 5G 5 ms, 4G LTE 40 ms). Radius in km:

Application (budget, processing)first hopperfect fiber (1.47)router path (2.3)median ping (3.2)
VR head tracking (16 ms, 5 ms)Wi-Fi816521375
4G LTE000
AR overlay (33 ms, 10 ms)Wi-Fi2,0391,303937
4G LTE000
cognitive assistance (100 ms, 40 ms)4G LTE2,0391,303937
web response (300 ms, 100 ms)4G LTE16,31510,4287,495
  • The first hop can spend the budget alone. Over LTE, a 40 ms first hop exceeds VR’s and AR’s entire budgets: no server placement helps. That is why the edge paper calls edge computing a natural partner of low-latency 5G. A fast first hop is worthless if the remaining hops to a distant cloud swamp it, and a nearby server is worthless behind a slow first hop.
  • Real networks shrink every radius by 2.2× (3.2 / 1.47) compared with a perfect fiber: paths are longer than great circles, and routers add delay.
  • Generous budgets don’t care: a 300 ms web response can be served from 7,500 km away even over LTE.

3.3 How many sites?

If every user must be within radius RR of a site, covering an area AA needs about 1.21 A/(πR2)1.21\,A / (\pi R^2) sites. The factor 1.21 is the density of the best (hexagonal) covering by discs, and the count grows as 1/R21/R^2: halving the radius quadruples the sites. Part B, for the contiguous US (8.1 million km², median ping inflation):

ApplicationWi-Fi5G4G LTE
VR head tracking2239impossible
AR overlay44impossible
cognitive assistance114
web response111

By median latency and geography alone, a few dozen well-placed sites would serve even VR. If that were the whole story, cloud regions would suffice.

3.4 The tail is what matters

It is not the whole story, because interactive budgets apply to the tail. A frame that is late 1% of the time is a visible glitch every few seconds. Part C adds a queueing model, with assumptions printed by the demo:

  • 4 router hops between the access network and any server in the network, plus one per 300 km;
  • each hop adds an exponentially distributed queueing delay with a mean of 1 ms, each way;
  • the 99th percentile must fit the budget. A sum of nn exponential delays has an Erlang distribution, so the code computes the percentiles exactly.
Applicationleft for the networkradius if the median fitsradius if the p99 fitssites (p99)
VR8 ms22 km0only at the access point
AR20 ms600 km261 km46 (vs 9 for the median)
cognitive assistance57 ms2,303 km1,800 km1

The p99 round trip to a server just behind the access network is already 16.0 ms in this model, and 39.5 ms at 1,000 km, before any propagation worth mentioning. VR fits only if the server is at the access point, with no router hops to queue in: a cloudlet “one wireless hop away”, in the edge paper’s phrase. Proximity buys low jitter as much as low latency. The exact counts depend on the assumed per-hop delay. The shape does not: more hops make a longer tail, and the tail is what the budget must cover.


4. Offloading: run it here, nearby, or far away?

4.1 The cost model

For a task with input II bytes, output OO bytes and demand WW phone-seconds:

Tlocal=Wsdev,Tremote=RTT+8IBup+Wssite+8OBdown.T_{\text{local}} = \frac{W}{s_{\text{dev}}},\qquad T_{\text{remote}} = \text{RTT} + \frac{8I}{B_{\text{up}}} + \frac{W}{s_{\text{site}}} + \frac{8O}{B_{\text{down}}}.

Offloading is faster when the compute saved exceeds the cost of the trip. With a 20× faster site, the break-even compute is

W∗=RTT+8I/Bup1/sdev−1/ssite.W^* = \frac{\text{RTT} + 8I/B_{\text{up}}}{1/s_{\text{dev}} - 1/s_{\text{site}}}.

Energy on the device counts:

  • the radio’s transmit power during the upload and its receive power during the download;
  • the device’s idle power while it waits;
  • for cellular radios, the tail: after the last packet, the radio stays in a high-power state for several seconds (we assume 5 s at 1 W) before dropping to idle.

4.2 Results

02_offload_or_not.py (assumed: phone 3 W computing, 0.3 W waiting; sites 20× a phone; cloudlet over Wi-Fi with a 4 ms RTT and 50/100 Mbps; cloud over Wi-Fi with 78 ms and 20/50 Mbps; cloud over LTE with 120 ms and 5/20 Mbps). Seconds / joules on a phone:

Tasklocalcloudletcloud (Wi-Fi)cloud (LTE)
face recognition (1 frame)0.40 s / 1.20 J0.03 s / 0.02 J0.12 s / 0.06 J0.24 s / 5.28 J
AR labels (1 frame)0.80 s / 2.40 J0.06 s / 0.03 J0.16 s / 0.08 J0.32 s / 5.45 J
chess move (deep search)5.00 s / 15.0 J0.25 s / 0.08 J0.33 s / 0.10 J0.37 s / 5.12 J
transcode 10 s of 1080p20.0 s / 60.0 J2.76 s / 2.35 J5.40 s / 5.38 J17.9 s / 46.5 J
tiny lookup0.01 s / 0.03 J0.01 s / 0.003 J0.08 s / 0.03 J0.13 s / 5.05 J
  • Compute-heavy, data-light tasks want to leave the device: a chess search took 5 s locally and 0.25 s on the cloudlet.
  • Data-heavy tasks need a fast first hop: transcoding meant uploading 10 MB. Over LTE’s 5 Mbps uplink that took almost as long as computing locally (17.9 s vs 20.0 s); the cloudlet did it in 2.8 s.
  • The weaker the device, the more offloading pays: on a wearable (0.1× a phone) face recognition took 4.0 s locally and 0.034 s on the cloudlet.
  • The break-even for a 60 KB input was 0.014 phone-seconds for the cloudlet, 0.107 for the Wi-Fi cloud and 0.227 over LTE. In Part B’s decision maps (7 compute levels × 5 input sizes), offloading paid in 26 of 35 cases with a cloudlet, 18 via the Wi-Fi cloud and 14 via LTE. The farther and slower the site’s network, the more work a task must carry to be worth shipping.

4.3 Energy and the cellular tail

Energy mostly follows time, with one big exception. A tiny lookup cost 0.03 J computed locally and 0.003 J via the cloudlet, but 5.05 J over LTE — 5.0 J of it the radio’s tail after the last byte. For chatty applications on cellular networks, the number of separate transfers matters more than their size. Batching requests (and coordinating background traffic across apps) saves far more battery than compressing them.

Our model counts only task energy; display and system power are not modelled. Real measurements include them. The edge paper reports an AR application at:

  • 1.1 J per operation via a cloudlet;
  • 3.1–9.4 J via AWS regions from near to far;
  • 3.3 J running on the device alone (paper’s numbers, from Ha et al. 2013).

So in reality, waiting for a far cloud can cost more energy than not offloading at all, because the device burns display and system power while it waits. Our model, with its small idle power, cannot show that, and we say so rather than tune it to agree.

4.4 What else goes into the decision

  • Availability: is the cloudlet or the network there right now? (§5, §7)
  • Load: a shared site may be busy (§5).
  • State and code: the site needs the application’s code and data. Cloudlets provision VMs or containers “just in time”, as the edge paper describes.
  • Privacy: some data should not leave the user’s trust domain.

5. Cloudlets vs the cloud, under load and under failure

5.1 A small site next door vs a big site far away

03_edge_vs_cloud.py simulates AR users on Lecture 1’s simulator. Each user sends a 50 KB frame, waits for the result, and sends the next, at most 10 frames/s. A server takes 20 ms per frame on average. The cloudlet has 4 servers with a 4 ms round trip; the cloud has 64 servers with a 78 ms round trip.

Userscloudlet p50 / p95fps per userbusycloud p50 / p95fps per user
126 / 78 ms10.05%112 / 157 ms8.5
1027 / 74 ms10.050%113 / 160 ms8.4
2065 / 128 ms9.696%112 / 159 ms8.4
30147 / 209 ms6.6100%112 / 159 ms8.4
60298 / 374 ms3.3100%112 / 159 ms8.4
  • Near is fast while there is capacity: 27 ms vs 113 ms median for up to 10 users, and full frame rate.
  • Small saturates: 4 servers serve 200 frames/s, which 20 users at 10 frames/s already offer. Past that, queueing takes over (Lecture 11): the p95 crossed the cloud’s at 30 users, and at 60 users each user got 3.3 frames/s.
  • An edge site must be provisioned for its peak, or shed load to the cloud when busy. The cloud was “slow but flat” because 64 servers stayed lightly loaded. Proximity buys latency only while there is capacity to spare. This is the edge paper’s management challenge in miniature: many small sites are harder to keep right-sized than a few big ones.

5.2 Masking outages

Part B cuts the wide-area network for 10 s. The cloud’s 10 users received 4 results during the outage (frames already on their way) and gave up on 106. The cloudlet’s users, on the near side of the failure, received 999 results and noticed nothing. A cloudlet can mask failures of the cloud or of the network for the services it hosts. The paper’s examples are hostile environments: military operations, disaster areas, regions with weak infrastructure, and parts of the Internet under attack.

What the cloudlet does during the outage is Coda’s playbook (Lecture 22): hoard (prefetch into a persistent cache), emulate (serve from it while disconnected and log the changes), reintegrate (propagate the changes and resolve conflicts afterwards).

5.3 Edge analytics: bandwidth, not latency

The edge paper’s example: 12,000 users uploading 1080p video need 100 Gb/s into the cloud, and a million about 8.5 Tb/s (paper’s numbers; scaling the first figure gives 8.3 Tb/s). If cloudlets analyze the video and send only results — tags, recognized objects, metadata, about 1 KB/s per stream by our assumption — the ingress shrinks about 1,000×. The paper speaks of three to six orders of magnitude, depending on what is kept. In the GigaSight design, the full video stays on the cloudlet for a limited time and can be searched later using the tags held in the cloud.


6. Adaptation: fidelity, agility and stability

6.1 Fidelity

When resources fall, an application-aware client lowers its fidelity: the degree to which the data it presents matches the reference copy. Examples are a lower video bitrate, a smaller or grayscale image, a coarser map, fewer search results, or a cheaper speech model. Odyssey’s design splits the work:

  • the system measures resources, notifies applications when they leave a window of tolerance, and arbitrates between applications;
  • the application decides which fidelity to use.

6.2 An adaptive player

04_adaptive_fidelity.py streams content in 2 s chunks at one of five fidelity levels (0.3–6 Mbps), with up to 30 s of buffer. It runs over synthetic bandwidth traces that wander between 0.2 and 15 Mbps (means 5.6 / 3.3 / 6.9 Mbps). Means over three traces, for 900 s of content:

Policyfidelitystallswitches
fixed 0.3 Mbps0.30 Mbps0 s0
fixed 1.5 Mbps1.50 Mbps73 s0
fixed 6 Mbps6.00 Mbps569 s0
rate-based, last sample2.96 Mbps0 s154
rate-based, EWMA α = 0.33.32 Mbps17 s55
rate-based, EWMA α = 0.054.19 Mbps161 s16
rate-based, harmonic mean of 52.86 Mbps0 s69
rate-based, EWMA 0.3 + hysteresis2.87 Mbps20 s38
buffer-based3.79 Mbps10 s71

A fixed fidelity is wrong most of the time: either it wastes the good moments or it stalls in the bad ones. A rate-based policy picks the highest level below 80% of its bandwidth estimate. How it estimates decides everything.

6.3 Agility vs stability

The 1996 paper names the figure of merit: agility, the ability to respond promptly to changes. It also warns that a highly agile system may be unstable, spending its resources reacting to minor perturbations. Part B measures both directly: a step from 8 to 1 Mbps and back, and a steady 4 Mbps link with noise.

Policyreacts to the drop install in the stepswitches/min on the noisy link
last sample9 s0 s17.7
EWMA α = 0.330 s0 s4.0
EWMA α = 0.05189 s81 s0.3
harmonic mean of 518 s0 s6.2
EWMA 0.3 + hysteresis28 s0 s1.8
buffer-based21 s0 s14.4

No estimator is both agile and stable: the faster it follows the link, the more it follows the noise. An EWMA with weight α closes 90% of the gap after a step in ln⁡0.1/ln⁡(1−α)\ln 0.1 / \ln(1-α) samples: 6.5 samples for α = 0.3 and 45 for α = 0.05 (exercise 5). Each sample is one chunk’s download, which takes longer exactly when bandwidth is low. Engineering ways out:

  • Asymmetry: be fast to go down and slow to go up. Hysteresis (switch up only with 50% to spare) cut switches from 55 to 38. A pessimistic harmonic mean, dominated by the slow samples, never stalled.
  • A different signal: the buffer-based policy uses no bandwidth estimate at all. It maps the buffer level to a fidelity (low below 6 s, high above 22 s), and it delivered the best fidelity with 10 s of stall. The buffer integrates the past and works as a low-pass filter on the network.
  • Global estimation from local observations (the 1996 paper’s last open problem): the client sees only its own throughput. A drop might be its own radio, a congested link, or a busy server, and the right reaction differs. Estimators are guesses about a global state from a local view.

Lecture 12 meets the same trade-off as control-loop design: reacting to a noisy signal with a delay.

6.4 Adapting to energy

Battery is a resource to adapt to as well. Flinn and Satyanarayanan’s goal-directed adaptation fixes a goal (“this battery must last 6 hours”) and lowers fidelity as needed to meet it. Part C (assumed: 1.2 W base + 0.25 J per megabit received and decoded; a 10 Wh battery; a 6 h goal):

Policylastedmet the goalmean fidelity
always 6 Mbps3.72 hno6.00 Mbps
always 3 Mbps5.13 hno3.00 Mbps
always 0.3 Mbps6.00 hyes0.30 Mbps
goal-directed6.00 hyes1.87 Mbps

Each minute, the goal-directed controller picks the best fidelity whose power, if sustained, fits the energy left over the time left. It met the goal at six times the quality of the safe fixed choice. The same structure — measure, compare with a goal, adjust a knob — is the feedback loop of Lecture 12.


7. Weak connectivity

7.1 Between connected and disconnected

Disconnection is the extreme case; much of the time a mobile client is weakly connected: a link that works but is slow, expensive or intermittent. Coda’s weak-connectivity work (Mummert, Ebling and Satyanarayanan 1995) added four mechanisms:

  1. Rapid cache validation: after reconnecting, validate whole volumes by version stamp instead of every file. These are the semantic callbacks of §1.4.
  2. Trickle reintegration: keep working from the cache, log updates in the client modify log, and ship the log to the server in the background.
  3. Log optimizations: a later store of a file cancels an earlier one still in the log; a create followed by a delete cancels both.
  4. User-assisted miss handling: if fetching a missing file would take long over the weak link, ask the user whether to wait.

7.2 The aging window

If the log ships an update the moment it is made, there is nothing to optimize. If it waits, later updates cancel earlier ones. 05_weak_connectivity.py replays a scripted hour of work (93 MB written) over a 500 kb/s uplink. The hour contains a report saved every 30 s, a growing log stored every 10 s, 40 editor temp files created and deleted, and one photo.

Aging windowshippedsaved by the logat risk (mean)server’s copy behind by (max)
0 s92.2 MB1%11 KB34 s
10 s60.2 MB35%175 KB44 s
60 s19.7 MB79%349 KB92 s
10 min4.5 MB95%738 KB600 s
30 min2.9 MB97%1,405 KB1,819 s

Waiting ten minutes cut the traffic by 95%: the report went out about once per window instead of 120 times, the temp files never left the laptop, and only the latest version of the log was sent. The price is exposure. With a 10-minute window, on average 738 KB of the user’s work existed only on the laptop, and the server’s copy could be ten minutes behind. Mobility is hazardous: if the laptop is lost, that work is lost. The window is a direct trade of bandwidth against risk, and different files deserve different windows.

One detail mattered more than expected. Our first log reset a record’s age whenever a newer store replaced it, so a file saved every 30 s was never old enough to ship. A replacement must inherit the age of the oldest change it replaces. Then the window bounds how far the server can fall behind.

7.3 Do not block the user

The weak link also carries the user’s own cache misses. Part B queues a 20 MB trickle backlog (after a long disconnection, say) on a 1 Mb/s link and issues a 100 KB cache miss every 15 s (Lecture 9’s prefetch.Link):

Trickle configurationcache miss p50worst
one FIFO queue, 1 MB pieces103.1 s159.9 s
demand first, 1 MB pieces5.3 s8.1 s
demand first, 64 KB pieces1.12 s1.36 s
demand first, 16 KB pieces0.96 s1.00 s
(the fetch alone, on an idle link)0.90 s

This is Lecture 9’s lesson again. Background traffic needs lower priority, and it must be sent in small pieces, because a demand request cannot interrupt a piece already on the wire. The backlog finished at about the same time in every case (160–168 s). Priority and small pieces cost the background almost nothing and save the foreground everything.


8. Design choices at a glance

QuestionLean this way when……and the other way when…
where to computeoffload when compute ≫ (RTT + upload) and a fast first hop existslocal when data is large, the link is slow or cellular, or the task is tiny
cloudlet or cloudcloudlet for tight latency/jitter budgets, bandwidth-heavy sensors, privacy, outage tolerancecloud when the budget is generous, load exceeds the edge’s capacity, or state is global
fidelityadapt with asymmetric reactions (fast down, slow up), or a buffer-based signalfixed only when the network is known and stable
estimatoragile (short memory) when the link changes in big stepsstable (long memory, hysteresis) when it is noisy around a level
aging windowlong for files rewritten often or cheap to loseshort for valuable, irreplaceable work
background trafficalways below demand, in small pieces—

Summary

  • Mobility is intrinsically different: devices are resource-poor and exposed, connectivity varies, energy is finite. Clients must adapt, either transparently to applications (Coda) or in cooperation with them (Odyssey).
  • Latency budgets fix a radius:
    • VR (16 ms) and AR (33 ms) are impossible over a 40 ms LTE first hop, wherever the server is;
    • over Wi-Fi the median allows hundreds to thousands of km, but the tail shrinks it: with queueing at each router hop, VR fits only at the access point and AR needs ~46 sites to cover the US instead of 9;
    • site counts grow as 1/R21/R^2.
  • Offloading pays when the computation saved exceeds the trip:
    • break-even 0.014 / 0.107 / 0.227 phone-seconds for a 60 KB input via cloudlet / Wi-Fi cloud / LTE cloud;
    • offloading paid in 26 / 18 / 14 of 35 cases;
    • the LTE tail made a tiny lookup cost 5 J instead of 0.03 J;
    • real measurements (paper) show far clouds can cost more energy than local execution.
  • Cloudlets gave 27 ms instead of 113 ms while they had capacity, but 4 servers saturated at 20 users, and the p95 crossed the cloud’s at 30. They masked a WAN outage completely (999 vs 4 results), and edge analytics cut ingress bandwidth ~1,000×.
  • Adaptation trades agility against stability:
    • last-sample estimation never stalled but switched 154 times;
    • a slow EWMA switched 16 times but stalled 161 s and needed 189 s to react to a drop;
    • hysteresis, pessimistic estimates and buffer-based control are the engineering compromises;
    • goal-directed energy adaptation met a 6 h battery goal at 1.87 Mbps, where a fixed 6 Mbps died at 3.7 h.
  • Weak connectivity:
    • an aging window of 10 min cut trickle traffic by 95% at the cost of up to 10 min of work at risk (a replacement must inherit the oldest change’s age);
    • background reintegration needs demand priority and small pieces (cache miss 0.96 s instead of 103 s).

Common pitfalls

  • Placing a server “close” behind a slow first hop. Fix the first hop first.
  • Sizing by median latency. Interactive budgets are about the tail, and every queueing hop fattens it.
  • Offloading tiny tasks over cellular. The round trip and the radio tail cost more than the computation.
  • Assuming the edge has infinite capacity. A cloudlet is small; provision it, or shed load to the cloud.
  • Ignoring display and system power in energy comparisons. Waiting is not free.
  • Reacting to every bandwidth sample, or to none. Pick an estimator for the link’s dynamics, and react asymmetrically.
  • Letting background synchronization share a FIFO queue with the user’s requests, or ship in huge pieces.
  • An aging window without a bound on exposure, or one that a frequently saved file can starve.

Exercises

  1. A budget. An interactive game needs 50 ms end to end. The game server needs 15 ms per update and the first hop takes 10 ms round trip. Using the median router-path inflation (2.3), how far can the server be? How many sites cover the contiguous US (8.08 million km²) at that radius?

    Answer(50 − 15 − 10) / 2 = 12.5 ms one way; 12.5 × 300 / 2.3 ≈ 1,630 km. Sites ≈ 1.21 × 8.08 × 10⁶ / (π × 1,630²) ≈ 1.2, so one well-placed site (two in practice for edge effects and redundancy). At a 100 km radius it would take about 311 sites, which is why tighter budgets are an economic question as much as a technical one.
  2. Break-even compute. A phone (speed 1) can offload to a server 20× faster over a link with a 50 ms RTT and 10 Mbps uplink. The input is 200 KB. Above how many phone-seconds of compute does offloading finish sooner? What changes over a 1 Mbps uplink?

    AnswerW* = (0.05 + 200,000 × 8 / 10⁷) / (1 − 1/20) = (0.05 + 0.16) / 0.95 ≈ 0.221 s. With 1 Mbps the upload takes 1.6 s, so W* = 1.65 / 0.95 ≈ 1.74 s: only big computations are worth shipping. Compressing or filtering the input on the device (sending features instead of pixels) lowers I and moves the boundary back.
  3. The tail of a radio. A weather widget polls a server every 5 minutes over LTE; each poll is a few hundred bytes. Assume a 5 s tail at 1 W after each transfer. How much energy per day do the tails cost, as a fraction of a 10 Wh battery? Suggest two fixes.

    Answer288 polls/day × 5 J = 1,440 J = 0.4 Wh, about 4% of the battery per day just keeping the radio awake. Fixes: poll less often, or let the server push updates; batch the poll with other apps' traffic (OS-level coalescing of background transfers); use Wi-Fi when available. Making each poll smaller does almost nothing.
  4. Sizing a cloudlet. AR users send 10 frames/s each; a server takes 20 ms per frame on average. How many servers does a cloudlet need for 50 users if servers should stay below 70% busy? What happens at 100 users?

    AnswerOffered work = 50 × 10 × 0.02 = 10 server-seconds per second. At 70% utilization: 10 / 0.7 ≈ 14.3, so 15 servers. At 100 users the offered work is 20 server-seconds per second: 15 servers saturate, queues grow (demo 03 showed p95 climbing past the cloud's beyond saturation), and the cloudlet should either scale up or redirect some users to the cloud. Lecture 11 makes "below 70% busy" precise with queueing formulas.
  5. How agile is an EWMA? An estimator updates e←αx+(1−α)ee \leftarrow αx + (1-α)e after each sample. The true bandwidth drops abruptly from B1B_1 to B2B_2. After how many samples has the estimate closed 90% of the gap, for α = 0.3 and α = 0.05? If each sample is a 2 s chunk at the old fidelity, roughly how long is that in seconds after a drop to one eighth of the old bandwidth?

    AnswerThe remaining gap after n samples is (1 − α)ⁿ: n = ln 0.1 / ln(1 − α) ≈ 6.5 for α = 0.3 and ≈ 45 for α = 0.05. After a drop to 1/8, a chunk chosen for the old bandwidth takes up to 8× longer to download (16 s instead of 2 s) until the level falls. So the slow EWMA can need minutes, and demo 04 measured 189 s, while the agile one needs well under a minute (30 s). This is why players react to *downward* steps fast and to upward steps slowly.
  6. The aging window. A 200 KB document is saved every 30 s for an hour over a weak link. How many bytes are shipped with no aging, and with a 10-minute window (with a replacement inheriting the oldest change’s age)? What is the worst-case amount of work lost if the laptop is stolen?

    AnswerNo aging: 120 saves × 200 KB = 24 MB (if the link keeps up). A 10-minute window: about one version per 10 minutes, 6 × 200 KB = 1.2 MB, 95% less. The worst case is up to 10 minutes of edits that exist only on the laptop. Without age inheritance the document would never be shipped at all, since each save would reset its age, and the risk would be unbounded.
  7. Semantic callbacks. A mobile client caches the result of SELECT name FROM users WHERE city = 'Pittsburgh'. Propose a cheap predicate Q, maintained by the server, such that Q implies the cached result is still valid. Compare a table-level and a predicate-level Q.

    AnswerTable-level: "the users table's version number is unchanged since the result was fetched". It is trivial to maintain, but any update to any user (in any city) invalidates the cache: false invalidations, like false sharing (Lecture 7). Predicate-level: "no insert, delete or update has touched a row whose old or new city is 'Pittsburgh'". It is more precise but costs the server a check per update, and real systems use indexes or partition versions to keep it cheap. Coda's volume version stamps are the table-level choice: coarse, but one round trip validates thousands of files after a reconnection.
  8. Application-aware vs transparent. For each, say whether system-level (transparent) or application-aware adaptation fits better, and why: (a) a file editor on a laptop that loses Wi-Fi on a train; (b) a video call when bandwidth halves; (c) a navigation app when the phone’s battery reaches 15%.

    Answer(a) Transparent: Coda-style caching and logging let an unmodified editor keep working; the right reaction (keep the files local, reintegrate later) does not depend on the editor. (b) Application-aware: only the application knows its options (lower resolution, lower frame rate, audio-only) and which one users prefer; the system's role is to measure bandwidth and tell it. (c) Application-aware with system arbitration: the system sets an energy goal (as in goal-directed adaptation) and the app decides how to meet it (fewer map redraws, coarser GPS sampling), while the system arbitrates between apps.
  • Project 2’s whole-file caching proxy is an ancestor of the mobile file systems described here: the same cache that hides latency is what lets a weakly connected client keep working. This lecture does not change P2’s requirements.
  • Problem Set 2 may include mobile caching scenarios. §4 (cost model), §6 (estimators) and §7 (aging, priorities) are the methods; the answers are not here.

Further reading

  • M. Satyanarayanan, “Fundamental Challenges in Mobile Computing”, PODC 1996 (course reading).
  • M. Satyanarayanan, “The Emergence of Edge Computing”, IEEE Computer 50(1), 2017 (course reading).
  • M. Satyanarayanan, P. Bahl, R. Cáceres, N. Davies, “The Case for VM-Based Cloudlets in Mobile Computing”, IEEE Pervasive Computing 8(4), 2009.
  • B. Noble et al., “Agile Application-Aware Adaptation for Mobility”, SOSP 1997 (Odyssey).
  • J. Flinn and M. Satyanarayanan, “Energy-Aware Adaptation for Mobile Applications”, SOSP 1999.
  • L. Mummert, M. Ebling, M. Satyanarayanan, “Exploiting Weak Connectivity for Mobile File Access”, SOSP 1995.
  • K. Ha et al., “Towards Wearable Cognitive Assistance”, MobiSys 2014.
  • T.-Y. Huang et al., “A Buffer-Based Approach to Rate Adaptation: Evidence from a Large Video Streaming Service”, SIGCOMM 2014.
  • A. Li et al., “CloudCmp: Comparing Public Cloud Providers”, IMC 2010.

Preview of Lecture 11 — Scaling out cloud services

A cloudlet saturated at 20 users; the cloud stayed flat because it had 64 servers. How many servers does a service need, where should requests go, and why does latency explode just before 100% utilization? Lecture 11 opens Part III with queueing: utilization and Little’s law, M/M/1 and M/M/k checked against simulation, scale-up vs scale-out, load balancing (random, round robin, join-the-shortest-queue, the power of two choices), and multi-tier services whose bottleneck moves as you add servers.


术语表 (Glossary, English → 中文)

English中文
mobile computing移动计算
resource-poor device资源贫乏的设备
hazardous mobility移动的危险性
variable connectivity多变的连接性
finite energy source / battery有限能源 / 电池
autonomy vs interdependence自治与相互依赖
adaptation / adaptive client自适应 / 自适应客户端
application-transparent adaptation对应用透明的自适应
application-aware adaptation应用感知的自适应
laissez-faire adaptation放任式自适应
extended client-server model扩展的客户端-服务器模型
semantic callback / validator语义回调 / 验证器
edge computing / cloudlet边缘计算 / 微云(边缘节点)
fog computing / micro data center雾计算 / 微型数据中心
cyber foraging网络觅食(借用周边计算资源)
computation offloading计算卸载
break-even point盈亏平衡点
first hop (wireless)(无线)第一跳
latency budget延迟预算
path inflation路径膨胀
jitter / tail latency抖动 / 尾延迟
Erlang distribution埃尔朗分布
covering density覆盖密度
radio tail energy无线电尾能耗
edge analytics / ingress bandwidth边缘分析 / 入口带宽
privacy mediator / denaturing隐私中介 / 数据脱敏
masking cloud outages屏蔽云故障
hostile environment恶劣环境
fidelity保真度
adaptive bitrate (ABR)自适应码率
rate-based / buffer-based adaptation基于速率 / 基于缓冲区的自适应
estimator / EWMA / harmonic mean估计器 / 指数加权移动平均 / 调和平均
agility / stability敏捷性 / 稳定性
hysteresis迟滞
global estimation from local observations由局部观测做全局估计
goal-directed (energy-aware) adaptation目标导向(能耗感知)的自适应
weak connectivity弱连接
disconnected operation断连操作
hoarding / emulation / reintegration囤积 / 模拟 / 重新整合
trickle reintegration涓流式重新整合
client modify log (CML)客户端修改日志
aging window老化窗口
log optimization / cancellation日志优化 / 抵消
rapid cache validation快速缓存验证
data at risk / exposure有风险的数据 / 暴露
← 返回课程目录