A phone app lets people send a batch of photos to a server. The server answers at once with a job id, then works through the photos in the background. The phone polls: it keeps asking about that job id until the results are ready, then fetches them and shows them.
Users kept telling us the same thing: their photos “did not come through”. So we looked at the server, and the server looked fine.
Key facts
- Every server number was healthy: the upload was answered in 0.6 s (median), 99% of jobs finished, and 99% of finished jobs produced results.
- Over 5.9 days, 196 of 2,837 finished jobs were never fetched by the phone: 937 photos, 7.6% of the photos the server processed.
- That was 76% of all the photos lost after they reached the server.
- The cause, as read in the client code: the job id lived only in the screen’s memory while it polled.
- About half of the lost batches were sent again, so the server did the same work twice.
What users said
“My photos did not come through.” The complaint was vague, and it came often enough to matter. No error came with it. The user had picked photos, pressed send, and later had nothing to show for it.
The server looked fine
Every number we had said the server was doing its job. The upload was answered in 0.6 seconds at the median. 99% of jobs finished. 99% of the finished jobs produced results.
All of that was true. It was also beside the point. Each of those numbers ends at the server. “Finished” means the server wrote the results and was ready to hand them over. It says nothing about whether anyone came to collect them.
Counting fetches
The server had no metric for delivery, but it had access logs. Every poll and every result read is a request with the job id in it. So we counted, per job id, how many times the phone came back for the result. Over 5.9 days of logs, this is the funnel:
| Stage | What the logs showed |
|---|---|
| Created (upload answered) | 0.6 s median answer |
| Finished | 99% of jobs |
| Produced results | 99% of finished jobs |
| Fetched by the phone | 2,641 of 2,837 finished jobs |
| Never fetched | 196 jobs, 937 photos (7.6% of processed photos) |
The server had done the work, the results were waiting, and the phone never asked for them.
The 196 split three ways:
- 91 never polled once after the upload was answered.
- 84 got only the “started” answer, then stopped asking.
- 21 got partial results and never came back for the rest.
Then came the number that changed how we saw the whole complaint. Of all the photos lost anywhere after they reached the server, 76% were lost this way. Not in processing, not in a failed job. They were lost after the work was done, between the server and the phone.
Where the job id lived
Next we read the client code. What follows is read in the code, not proven per user.
After the upload was answered, the app kept the job id in one place: the memory of the screen that was polling. Nothing wrote it down. If the user left that screen, closed the app or locked the phone, the screen’s memory went, and the job id went with it. The server still held the finished job. The phone no longer knew it existed.
A batch of photos takes time, and people do not stare at a spinner. They switch apps. They put the phone in a pocket. Each of those normal actions could cut the thread.
The two app builds in use gave a useful check. The older build lost 11.4% this way; the newer one lost 2.5%. When the user leaves the screen, the newer build hands the job to a saved queue instead of dropping it. Same server, same flow; the difference is where the job id is kept.
There was a second, smaller trap on the server side: finished results were kept for one day. A user who came back after that found nothing to collect. A day was shorter than the user’s attention span.
What it cost
About half of the lost batches were sent again by the user. From their side, that is the obvious move: it did not work, so try again. From the server’s side, it is a second full run of the same work, and more of the daily quota spent on photos it had already processed.
What you can do tomorrow
The lesson is small and easy to miss. “Finished” is a server fact. “Delivered” is a client fact. We measured the first carefully and the second not at all. It is the same shape as an undo job that said done while one percent never came back: “done” was reported by the side that did the work, and nobody checked the end state.
- Measure “fetched” next to “finished”. You likely have the data already. Count result reads per job id in the access logs, and put that number next to finished jobs. A gap between the two is lost work.
- Store the job id durably the moment the upload is answered. Before any polling starts, write it somewhere that outlives the screen: local storage, a small on-device database, a saved queue. Polling can then stop and start again without losing the job.
- Keep finished results longer than the user’s attention span. A day was too short. On the next app open, look for jobs that finished but were never collected, and show them.
- Make a re-send of the same batch return the existing job. If the same batch arrives again, answer with the job that already exists instead of starting a new run. The user gets their results, and the server does not do the work twice.
What we could not see
The app sends no client telemetry, so we cannot say which action caused each loss: a screen change, a closed app or a locked phone. The cause above is what the code allows, not a trace of each user.
The 5.9-day count from the logs is a lower bound. To check the method, we compared it with an exact count over 24 hours: the log method matched on 669 of 676 jobs. The real loss is at least this high.
Common questions
Why did the server numbers not show this?
Because each of them ends at the server. Upload time, finished jobs and jobs with results all describe work the server did. None of them counts whether the phone came back for the result, so a job could finish, wait and expire without any number moving.
How do I count fetches without client telemetry?
Use the access logs you already have. Group requests by job id, and for each finished job count the reads of its result. A finished job with no result read was never delivered. Check the method once against an exact count over a short window.
Melta is free; get it on the App Store or Google Play.