In a mobile app's design, what are over-fetching and under-fetching for one screen, and why do both cost more on a slow cellular link?
answer
- bytes the screen never draws
- round trips the screen waits on
- latency, not only bandwidth
- dependent calls queue up in sequence
- shape the response to the screen
basics
~20 sOver-fetching downloads fields a screen never shows; under-fetching makes the screen send several requests, often one after another, to build one view. On a slow, high-latency cellular link the first wastes scarce bandwidth and data, the second stacks round trips.
solid answer
~50 s**Over-fetching** is an endpoint returning far more than the screen draws: a hotel search list that receives full hotel records, with long descriptions and every room type, just to show a name, a price, a rating and a thumbnail. **Under-fetching** is the opposite: one call cannot fill the screen, so the app makes several, and when one call needs an ID from another's answer they run one after another. On a phone both hurt more than on a desktop: cellular round trips are long and variable, bandwidth can be tiny while roaming, data may be metered, and a low-end phone pays CPU time to parse every byte it receives. The fix is to shape the response to the screen, with a screen-shaped endpoint, a field selection or a server-side composer, so one round trip carries what the view needs.
go deeper
Recall both definitions with one example each from a screen you know: extra fields versus extra calls. Then say why a slow, high-latency cellular link makes each one expensive.
Explain dependent versus independent calls: independent ones overlap on one connection, dependent ones add a round trip each. Put a number on one screen's waste in bytes and in round trips.
Show judgment: some over-fetching is a deliberate prefetch, and every way of shaping responses moves cost to the server. Say where you would shape this app's screens and why.
Treat response shaping as a contract decision across many screens and years of builds: who owns screen-shaped responses, how they evolve, and when per-screen endpoints sprawl enough to justify a query layer.
## Two opposite mismatches A screen in a mobile app needs a particular set of data to render. The API behind it rarely returns exactly that set, and the mismatch comes in two directions: - **Over-fetching** — the response carries fields the screen never shows. A search-results row needs a hotel's name, price, rating and a thumbnail URL, but the endpoint returns the whole hotel record: the full description, every amenity, every room type and its cancellation terms. - **Under-fetching** — one response is not enough to fill the screen, so the app makes several requests. A hotel detail screen may need the hotel record, its photos, a review summary and live room availability, each from a different endpoint. Under-fetching becomes much worse when calls are **dependent**: the availability call needs the room or rate identifiers that only the hotel call returns, so it cannot start until the first answer arrives. Independent calls can overlap; dependent calls cannot. ## Why a phone pays more than a desktop The same mismatch costs a mobile client more, for several reasons that stack: - **Latency dominates.** A cellular round trip is long and varies widely; on a roaming connection abroad it can take hundreds of milliseconds before the server even starts work. Every dependent call adds at least one full round trip. - **Bandwidth can be tiny.** On a congested or roaming link, throughput can fall to a slow 2G-class rate, so unused kilobytes turn into seconds. - **Data costs money.** Roaming data is often metered, so over-fetched bytes are paid for by the user. - **Parsing costs CPU.** A low-end phone must decompress and parse every byte it receives, including fields it then throws away. - **The radio stays busy.** Each extra exchange keeps the radio in a high-power state longer; the energy model belongs to the device's network budget, but it points the same way. ## A worked number from a travel-booking app Take the scenario's own numbers: a roaming link of about 100 kbit/s (12.5 KB per second) and a round trip of about 400 ms. | Mismatch | What the screen does | Network cost | |---|---|---| | Over-fetching | 30 search results at about 8 KB each = 240 KB | about 19.2 s of transfer | | Shaped list | 30 rows at about 300 bytes each = 9 KB | about 0.7 s of transfer | | Under-fetching | hotel, then rooms, then availability, each waiting for the last | 3 × 400 ms = 1.2 s of waiting alone | | Composed call | one request returns all three parts | about 400 ms of waiting | The numbers ignore handshakes and server time; real links add both. The point stands: on this link the search list is unusable when over-fetched, and the detail screen spends more than a second just waiting on round trips when under-fetched. ## Ways to shape the response to the screen There are three common places to fix the mismatch, and each moves cost somewhere else: 1. **A screen-shaped endpoint** — the API offers a list view and a detail view, or a parameter that selects a sparse set of fields. Simple and cacheable, but every new screen asks the server team for a new shape. 2. **A client-specified query** — a query language such as GraphQL lets the client name exactly the fields one screen needs in one request; the server then pays the cost of resolving arbitrary selections. 3. **A server-side composer** — a backend-for-frontend calls several services inside the data centre, where a hop is cheap, and returns one response sized for the screen. ## Over-fetching is not always a defect Some over-fetching is deliberate. Including a few detail fields in each search row can make the detail screen open instantly when most users tap through, trading extra bytes for a saved round trip. That is a prefetch bet, measured by how often users actually tap and by what the link costs, and the cost model for that bet belongs to the device's network budget. The defect is accidental waste: bytes nobody decided to send. ## What to say in the interview - Name both directions and give one concrete example of each from the app being designed. - Separate dependent calls, which serialise, from independent ones, which can overlap on one connection. - Put a number on it: bytes per list, round trips per screen, on the slowest link the app must support. - Say where you would shape the response, and what that choice costs the server team.
- Is putting detail-screen fields inside each search result ever the right call for a mobile app?Yes, when most users tap through and the extra bytes are small next to the round trip they save. It is a deliberate prefetch, so it should be measured: tap-through rate, the added bytes per page and the link the app usually runs on. If few users open details, the extra fields are just waste on a metered link.
- Does sending a screen's calls in parallel solve under-fetching on a mobile link?Only partly. Independent calls can overlap on one multiplexed connection, so together they cost roughly one round trip. Dependent calls cannot overlap, because the second needs the first's answer. Parallel calls also each carry headers, each need their own failure handling, and the screen must cope with some parts arriving and others failing.
- Bandwidth is the only network cost; the number of requests does not matter on mobile.
- Fetching the full object costs nothing extra once the connection is open.
- Firing dependent calls in parallel removes their sequential round trips.
- Over-fetching is always a defect, even when it deliberately prefetches the next screen.
- Compression makes unused fields free, so trimming the response is pointless.