Skip to the page

Trade-offs and mobile system design · senior

Mobile system design: image upload with retry

A reliable photo upload compresses on the device, uploads straight to object storage with a short-lived pre-signed URL (in chunks or a resumable session for big files), keeps a persisted job queue that survives app kills, retries with exponential backoff and jitter, and marks success only after your server confirms.

The notes

What you must know

  • Flow: pick or capture → resize and compress (for example 1600 px long edge, quality about 0.7) and strip location EXIF if not needed → create an upload job in SQLite → get a pre-signed URL from your API → upload → confirm with your API → mark done.
  • Big files: multipart or resumable uploads (S3 multipart, GCS resumable, tus) so a dropped connection continues from the last chunk.
  • Retry: exponential backoff with full jitter and a max attempt count; retry only retryable errors (timeouts, 5xx, 429), never 4xx validation errors.
  • Idempotency: the job id is the idempotency key, so a retried confirm does not create two posts.
  • Survive app kills: the queue is persisted and resumes on the next launch or foreground. expo-file-system has upload tasks with progress; for uploads that continue in the background use native background transfer (iOS background URLSession, Android WorkManager) through a library or module.
  • UX: per-item progress, cancel, a failed state with retry, and "Wi-Fi only" for big videos when the user chooses it.
  • Security: pre-signed URLs expire quickly and limit content type and size; validate again on the server.

The red pen

Common traps: mistake → fix

  • Mistake: Uploading through your API server

    Fix: doubles bandwidth and cost; upload directly with a pre-signed URL.

  • Mistake: Retrying immediately in a loop

    Fix: creates a thundering herd; use backoff with jitter.

  • Mistake: Keeping the queue only in memory

    Fix: it is lost when the OS kills the app.

Easy to hard

Questions interviewers ask, easy to hard

  1. Design image upload for a seller app used on slow 3G networks.
  2. The app is killed at 60% of a 50 MB video. What happens?
  3. How do you avoid duplicate posts when the confirm call times out?
  4. How do you show progress for 10 photos at once?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview