Design an Asynchronous File Analysis and Reporting System
Design a secure large-file intake workflow that performs asynchronous analysis and exposes durable progress and reports.
Problem statement
For this exercise, assume authenticated users upload files for an asynchronous analysis that produces one durable report. Files may be too large to proxy through the application service, so clients use resumable or multipart upload sessions against object storage.
The service validates ownership and file metadata, seals one immutable input version, queues analysis, exposes progress and terminal status, and lets the owner retrieve the completed report. A user retry must not create duplicate logical analyses, and a worker retry must not publish two terminal reports.
Assume files are at most 5 GB, the service starts up to 200 uploads per second, and up to 20,000 analyses may be active. A healthy status read should complete within 300 milliseconds, accepted progress should normally be visible within two seconds, and 99% of supported files should finish within 15 minutes.
Retain inputs and reports for 30 days unless the owner deletes them.
Design upload authorization, multipart completion, immutable input identity, job admission, queues and workers, progress aggregation, retry and lease behavior, report publication, access control, deletion, observability, and recovery from ambiguous object-store or worker outcomes.
The analysis algorithm itself, collaborative editing, and long-term archival are outside scope.
What to build
- An authenticated user can create, resume, and finalize a direct multipart upload whose sealed object belongs to one immutable input version.
- The owner can start one logical analysis per idempotency key and observe queued, running, completed, failed, cancelled, or expired status.
- The owner can read monotonic progress and reconnect without losing the latest committed job state.
- The owner can retrieve exactly one immutable published report for a completed analysis and cannot access another user's input or result.
At scale
- For this exercise, support files up to 5 GB and start bursts of 200 upload sessions per second without proxying file bytes through application servers.
- For this exercise, allow up to 20,000 active analyses and make accepted progress visible within two seconds.
- For this exercise, target 300 milliseconds p95 for healthy status reads and completion within 15 minutes for 99% of supported files.
- For this exercise, retain immutable inputs and reports for 30 days unless an authorized owner requests deletion.