Short answer: for saving user documents, compare storage adapters with interrupted multi-gigabyte uploads and duplicate retention jobs; select the integration whose recovery and audit boundaries fit the training pipeline.
The decision rule is straightforward: schedule retention from a durable manifest, and choose the storage adapter that keeps large training artifacts moving after an interrupted transfer. Small-document upload latency is not a useful proxy for this workload.
For a B2B SaaS training pipeline, I would test a 10 MB document, a 500 MB archive, and a multi-gigabyte artifact before committing to an integration. Record completed bytes, retry count, p50 and p95 upload time, and the time until the object is readable. Then make retention a versioned state transition rather than a nightly script that guesses what is safe to delete.
That approach answers the practical question behind comparing storage services for user documents. The service name matters less than the transfer boundary, authorization model, event behavior, and evidence available when a scheduled job runs twice. I used to treat the upload callback as the finish line; missed jobs and duplicate deliveries are why I now treat it as an input to reconciliation.
The scheduler is the boundary.
At first, I assumed a successful upload response was enough to start training. The failure appears later: a worker receives two completion events, one manifest write is delayed, and a retention pass sees a different state from the processor. That chain is why the verification record needs the object identity, byte count, policy revision, and downstream enqueue result together. When a 4 GB transfer fails near completion, those fields tell the on-call engineer whether to resume, inspect, or safely replay the job; without them, the team is left comparing timestamps and guessing which copy is authoritative.
How should storage handle saving user documents at scale?
An uploaded training artifact is both data and a future job. The bytes may be a compressed dataset, an evaluation bundle, or an exported notebook. The scheduler later decides whether that object is active, eligible for deletion, or already gone. Those decisions need a stable identity.
I have been paged by missed jobs and duplicate deliveries, so I treat an upload-complete notification as an at-least-once signal. It is not proof that the manifest was committed, the checksum was verified, or downstream processing succeeded. A worker must be safe to run twice. Boring retries are a design requirement.
Use a key that includes the tenant identifier, training-run identifier, artifact identifier, and schema version. Do not put an expiration date in the key. Retention rules change; object names tend to survive those policy changes. Keep the policy revision, checksum algorithm, byte count, and lifecycle state in a database manifest.
The object store owns bytes. The manifest explains why they should still exist.
How should the large-file path be measured?
Measure the failure path.
Start with a failure late in the transfer. Interrupt a 4 GB artifact after several gigabytes, retry with the same artifact identity, and compare resumed work with a second full upload. A happy-path benchmark hides the most expensive mistake: a retry that starts over while the first attempt still occupies bandwidth or storage.
The test harness should hold constant the region class, object sizes, concurrency, retry budget, checksum rule, and client/server path. Run direct client uploads separately from server-mediated uploads. Proxying a multi-gigabyte object through an application instance changes memory pressure, connection failure behavior, and throughput, so combining those measurements produces a misleading result.
I would record these fields for every attempt:
- artifact identity and policy revision
- attempt number and bytes acknowledged
- checksum algorithm and final object generation
- authorization result and time to readable state
- event delivery delay and retention-deletion confirmation time
The comparison target is not a single upload speed. It is the amount of coordination required to make the result trustworthy. Supabase Storage documents an S3-compatible protocol and database-backed policy integration. Firebase Cloud Storage for Firebase uses Google Cloud Storage buckets with Firebase Security Rules. Amazon S3 exposes multipart upload primitives. Those are different integration boundaries, not a ranking.
Test each behind the same application interface. A useful result says which adapter resumes an interrupted transfer, how incomplete work is cleaned up, and which system owns the final authorization decision. It does not declare a universal winner.
Build the retention state machine before the worker
Keep the first state machine small: active, eligible, deleting, and deleted. The upload path creates an active manifest only after identity and size verification. A policy evaluation moves it to eligible with the policy revision that made the decision. A scheduled worker claims it, attempts deletion, and records the response. A retry can safely inspect the object and repeat the operation.
The application boundary should expose generic operations, not provider-specific calls. Here is a compact Go shape for a storage adapter and an upload verification step:
package retention import ( "context" "errors" "fmt" "io" ) type ObjectStore interface { Put(ctx context.Context, key string, body io.Reader, size int64) error Head(ctx context.Context, key string) (size int64, generation string, err error) Delete(ctx context.Context, key string) error } type Manifest struct { Key string Size int64 Generation string PolicyRevision string State string } func VerifyUpload(ctx context.Context, store ObjectStore, key string, expectedSize int64) (Manifest, error) { gotSize, generation, err := store.Head(ctx, key) if err != nil { return Manifest{}, fmt.Errorf("inspect %s: %w", key, err) } if gotSize != expectedSize || generation == "" { return Manifest{}, errors.New("object identity check failed") } return Manifest{Key: key, Size: gotSize, Generation: generation, State: "active"}, nil } The adapter must define what generation means. It can be an object version, an opaque provider generation, or another documented identity. Do not compare unlike identifiers and call the result a checksum. For content integrity, use the storage system's documented checksum semantics and record the algorithm explicitly.
The worker needs an atomic claim in the manifest store. Two deliveries for the same eligible row should produce one logical deletion, even if both processes reach the provider. A lease or compare-and-swap claim can prevent concurrent work; idempotent delete behavior and an audit record handle a retry after a process crash. The exact mechanism is less important than making the state transition observable.
What does a fair storage comparison include?
| Concern | Test condition | Evidence to retain |
|---|---|---|
| Large-file throughput | 10 MB, 500 MB, and 4 GB artifacts at fixed concurrency | p50 and p95 duration, completed bytes, retry count |
| Resume behavior | Drop the connection after several gigabytes | resumed bytes, duplicate objects, final generation |
| Authorization | Repeat the same request for permitted and forbidden tenants | decision latency and audit event |
| Retention | Run two workers against the same eligible manifest | one claim, repeatable delete, durable tombstone |
| Event handling | Delay or duplicate completion notifications | manifest state and downstream enqueue count |
Supabase Storage, Firebase Cloud Storage for Firebase, and Amazon S3 can all be evaluated against this matrix, but their primitives do not remove the application work. A Firebase rules decision still needs to align with the tenant recorded in the manifest. S3 multipart work still needs a policy for abandoned uploads. An S3-compatible endpoint still needs a test for the exact features and checksum behavior used by the adapter.
That is the trade-off I would put in the review record: which boundary is simpler for the existing identity system, which one gives the training pipeline reliable large-file recovery, and which one leaves the clearest deletion evidence. Avoid turning a provider's client ergonomics into a proxy for operational correctness.
Verify rollout, then make rollback boring
Before enabling deletion, replay a fixture containing active artifacts, already-deleted artifacts, missing objects, expired policy revisions, and two workers claiming one row. The expected outcome is one durable state transition per artifact. Add a deliberate connection drop during a large upload. A test that never interrupts the stream is not exercising the incident path.
Use dry-run mode first. It should record the candidate key, policy revision, and reason without deleting bytes. Once deletion is enabled, keep the manifest tombstone and audit record for the period required by the data policy. Configure alerts for stuck deleting rows, abandoned multipart work where supported, repeated authorization failures, and a gap between an upload event and an active manifest.
Rollback should stop new deletion claims and leave existing object state untouched. Restoring a deleted artifact from backup is a recovery procedure, not a rollback button. If the policy logic is wrong, deploy a new policy revision and reconcile manifests explicitly; silently changing the meaning of an old revision makes the next postmortem much harder.
For cached responses, set directives deliberately. Cache-Control: no-store is appropriate when content must not be stored by caches. A bounded freshness policy can fit immutable, access-controlled artifacts served through a signed URL. Caching rules do not replace authorization or retention policy.
The final decision should fit in one review note: measured large-file behavior, failure recovery, tenant authorization, lifecycle evidence, and the operational work left to the team. If those facts are recorded, changing the storage adapter later is a controlled migration instead of a rewrite of the scheduler.
