skip to content

In a mobile design round for a transit app, how do you estimate payload per screen, requests per session and a week's offline disk budget?

level: middleimportance: should knowfreq 45%

answer

  1. the device's numbers, not the fleet's
  2. items times bytes, labelled assumptions
  3. refreshes dominate a session's requests
  4. service-day types, not seven days
  5. a weekly download can dwarf live use

basics

~20 s

Multiply stated assumptions for one device: departures per screen times bytes each, requests per session including refreshes, stop-times per service day times bytes per row. Then compare the results with the rider's data plan and free storage, never with server capacity.

solid answer

~50 s

I size the device, not the fleet, and label every input as an assumption. A departures screen: assume 20 rows of about 150 bytes plus about 1 KB of header, so **about 4 KB**. A commute session: one launch check, one departures load, ten 30-second refreshes, one trip plan, one ticket check, so **14 requests and about 58 KB**, mostly refreshes. Offline timetables: assume 200 lines × 120 trips × 25 stops = 600,000 stop-times per service day, three service-day types, 6 bytes a row, so **about 11 MB**, or about 72 MB as naive JSON at 40 bytes a row. Tickets are kilobytes. The punchline: refreshing the full timetable weekly costs over ten times a month of live use, so the default is the rider's saved lines, and big refreshes wait for an unmetered network.

code

pseudocode · 12 lines
pseudocode
// every input is an assumption stated aloud in the round
departures_screen = 20 * 150 + 1000                 // about 4 KB
session_bytes = 2000 + 11 * departures_screen + 10000 + 2000
                                                     // 14 requests, about 58 KB
month_live = session_bytes * 2 * 30                  // about 3.5 MB

stop_times_per_day = 200 * 120 * 25                  // 600,000
week_rows = stop_times_per_day * 3                   // 3 service-day types
week_compact = week_rows * 6                         // about 10.8 MB
week_json = week_rows * 40                           // about 72 MB
saved_lines_only = 5 * 120 * 25 * 3 * 6              // about 270 KB
month_of_weekly_full_refresh = week_compact * 30 / 7 // about 46 MB

go deeper

for a junior

Recall that device sizing is simple multiplication, items per screen times bytes per item, on assumptions said aloud.

for a middle

Work the three numbers end to end with stated inputs: a screen's payload, a session's requests including refreshes, and a week of offline data by service-day type.

for a senior

Use the numbers to decide: saved lines by default, big refreshes off metered networks, tickets never evicted, and payload format as a deep-dive candidate.

for a principal

Tie the data budget to who can afford to use the service, and the disk budget to the oldest devices the operator commits to support.

## Device-side sizing is not capacity planning In a mobile design round, sizing answers questions about **one phone**: how many bytes a screen pulls, how many requests a typical session makes, how much disk the offline data needs, and what all that costs a rider with a prepaid plan and an old phone. Multiplying by daily users to size servers is a different exercise that belongs to the back end's design. The device's numbers drive real client choices, such as what to store, how often to refresh and when to download, so they are worth a few minutes. No source gives a 'typical' payload size, compression ratio or network speed. Every input is an **assumption**, said aloud and kept round so the arithmetic is easy to follow and easy for the interviewer to correct. ## The assumptions | Input | Assumed value | |---|---| | Rows on a departures screen | 20 departures | | Bytes per departure row (line, direction, scheduled and expected time, platform, status) | about 150 bytes as JSON | | Stop header and alerts | about 1 KB | | Refresh interval while the screen is visible | 30 seconds | | Network size | 3,000 stops, 200 lines | | Trips per line per service day; stops per trip | 120 trips; 25 stops | | Distinct service-day types in a week | 3 (weekday, Saturday, Sunday) | | Bytes per stop-time row | about 6 in a compact binary layout; about 40 as naive JSON | | Rider's data plan | 1 GB a month, prepaid (the scenario's figure) | ## Payload per screen and requests per session 1. **Departures screen**: 20 × 150 bytes = 3,000 bytes, plus about 1 KB of header, is **about 4 KB** before compression. 2. **A commute session**: one launch check (about 2 KB), one departures load plus ten refreshes over five minutes at the stop (11 × 4 KB = 44 KB), one trip plan (about 10 KB) and one ticket status check (about 2 KB) make **14 requests and about 58 KB**. 3. **A month**: two sessions a day for 30 days is **about 3.5 MB**, well under 1% of the assumed plan. The striking number is the shape, not the total: **ten of the fourteen requests are refreshes**. Each one can wake the cellular radio, which costs battery as well as data. The refresh interval, and stopping refreshes when the screen is not visible, are the levers that matter. ## Disk budget for a week offline 1. **Stop-times per service day**: 200 lines × 120 trips × 25 stops = **600,000**. 2. **A week**: timetables repeat by service-day type, so a week is 3 patterns, not 7 days, giving **1.8 million** rows. 3. **Bytes**: 1.8 million × 6 bytes is **about 10.8 MB** compact, or × 40 bytes **about 72 MB** as naive JSON. 4. **Stops**: 3,000 × about 100 bytes is about 0.3 MB. 5. **Tickets**: assume up to 10 active and recent tickets at about 2 KB each, about 20 KB. Scoped to the rider's five saved lines instead: 5 × 120 × 25 × 3 = 45,000 rows × 6 bytes is **about 270 KB**. ## What the numbers change - **Default to saved lines.** 270 KB fits any phone; 72 MB of JSON does not belong on an old phone with little free storage. - **Large refreshes cost more than live use.** Re-downloading the full compact timetable every week is about 46 MB a month, over ten times the 3.5 MB of live use. Big refreshes should wait for an unmetered network or the rider's choice, or ship only what changed; how is the sync and budgets deep dives' business. - **Tickets are negligible.** At kilobytes each there is never a reason to evict a ticket to make room; schedules are the evictable data. - **Format matters at this scale.** The gap between 6 and 40 bytes a row is the gap between 11 MB and 72 MB, which makes payload format a candidate deep dive. ## Mistakes - Multiplying by daily active users and answering with server requests per second. - Quoting sizes as industry facts instead of labelled assumptions. - Sizing seven calendar days when the schedule repeats by service-day type. - Forgetting refreshes, which dominate the request count. - Sizing disk without asking how much free storage the oldest supported phones have.

  • The interviewer asks how many requests per second your servers will see. How do you answer in a client round?
    Give the per-device figure, about 14 requests a session, mostly 30-second refreshes, and note that multiplying by riders and peak factors is the back end's sizing exercise. Then return to what the client controls: the refresh interval, pausing refreshes when the screen is hidden, and serving the first view from stored data.
  • Why count service-day types instead of seven separate days?
    Because a timetable repeats: most networks run a weekday pattern and a few weekend or holiday patterns. Storing three patterns plus a calendar that maps dates to patterns covers the week; seven copies would more than double the disk budget for no new information. Holiday exceptions are small additions on top.

  • Device sizing means multiplying by daily active users
  • Typical payload sizes are industry standards you can quote
  • A week of timetables means storing seven separate days
  • Live refreshes are a negligible share of a session's requests
  • Tickets are the biggest item in the offline disk budget