API performance on mobile networks

Backends for mobile apps Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Pick the fix

A screen loads in 3 s on 4G; the server spends 80 ms. Where is most of the time likely going?

Options
Hint 1 of 1

How much of 3 s is the server?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Network round trips and payload transfer between phone and server

Correct. The server is a small fraction; cut calls and bytes.

If the server spends 80 ms of a 3-second load, the other 2.9 s is network: DNS, TLS, round trips and bytes on a mobile link. Fewer requests and smaller payloads cut that time.

Why not the others?
  • B The database. The whole server side takes 80 ms.
  • C Python's GIL. Server time is already small.
  • D The CDN. Not even in the path for API calls here.

30-second answer

Round trips dominate on mobile, often 100 ms or more each, so cut them: one call per screen, HTTP/2 or HTTP/3 connection reuse, and no redirect chains. Shrink payloads with sparse fields, pagination and compression. Make responses cacheable with ETags so repeat visits cost a 304. Support retries safely with idempotency keys and short client timeouts, and return partial data instead of failing the whole screen when one dependency is slow.

Practise saying it · 30 s. No recording, just a timer

Fast on mobile.

Say your answer out loud, then check which of these points you covered:

  • Fewer round trips
  • Smaller payloads
  • ETags / 304
  • Safe retries
  • Partial responses

Deep dive

HTTP/3 (QUIC) handles network switches and packet loss better.

Prefetch the next screen's data when idle on Wi-Fi.

Measure from real devices (RUM), not just server latency.

TLS session resumption saves handshake round trips.

Common mistakes

  • Chatty APIs with many small calls per screen.
  • Returning every field of every object.
  • Measuring only server-side latency.

Senior take & follow-ups

Round trips first, then payload size, caching, safe retries and partial responses.

Follow-up questions

Think of your answer first, then open the hint.

  1. Why do round trips matter more than bandwidth?

    Show hint

    Latency per trip is high on cellular networks.

  2. What does an ETag save?

    Show hint

    The body on repeat requests: a 304 instead of 200 with data.

Suggest a fix if something here is wrong or out of date.