Short answer: for an edtech service retaining signed documents until a deletion deadline, make the upload record the source of truth, then use multipart upload for large backup files and a single request for small ones. Throughput is the selection axis, but the record must also explain what happened to every part and whether deletion was actually attempted.
| Choice | Large-file throughput | Recovery shape | Operational fit |
|---|---|---|---|
| Single request | One stream; a retry can resend the whole file | Restart from byte zero | Small artifacts and cheap retries |
| Multipart upload | Bounded parallel parts | Resume by upload ID and part number | Large backups with variable links |
| Client-direct multipart | Moves transfer work away from the app worker | Server tracks intent while the client sends bytes | A worker's egress is the bottleneck |
The recommendation is the middle row when the backup worker owns the transfer. It gives the application a useful checkpoint without making the storage service responsible for retention policy. That distinction matters for signed documents: an object that exists is not automatically an object that is accounted for, and an upload that never completes is not a retained document.
The deletion deadline is the real contract
Start with the audit question, not the SDK method: can an operator prove which bytes were accepted, which object was completed, and why it was deleted on a particular date? A database row should answer those questions without reading worker logs.
The deadline comes first.
For each backup, store an application backup ID, an object key, an upload ID, the fixed part size, the expected byte count, the received part numbers, provider-returned part identifiers, a checksum when the storage interface exposes one, deleteAt, and the current state. Keep immutable transition events beside that mutable row. A complete state without a completion timestamp is weak evidence; a deleted state without a deletion result is weaker still.
This is where I get suspicious of attractive abstractions. If the SDK hides the upload ID or turns every retry into a fresh upload, the code may look pleasant while the recovery model is missing. I benchmark time to first part, sustained bytes per second, retry rate, memory high-water mark, and abandoned-upload count. The fastest happy path is not enough.
Use an opaque key that cannot collide with another backup. Put the deletion deadline in application metadata, too, but do not treat object metadata as the only policy store. The retention worker needs to find due records even if the upload worker disappeared halfway through a transfer.
Which throughput test earns multipart upload?
Multipart is justified by measured transfer behavior, not by file size alone. Run the same backup dataset through a single request and through bounded multipart concurrency. Record bytes per second, time to first byte, retry rate, peak memory, and recovery time after a process kill. Test the slowest link that the edtech service must support, because a clean office network can hide the failure that matters to a school or regional worker.
Four concurrent parts and a 64 MiB part size are useful test points, not defaults. A larger part may improve transfer efficiency while increasing restart cost; more concurrency may lift throughput while exhausting the worker. The threshold is the point where the recovery and memory costs are acceptable for the actual signed-document backup window.
Measure it.
How can Node.js resume, complete, or abort a multipart upload?
The worker needs a small state machine with explicit transitions:
- Insert an
uploadingrecord and create a multipart upload. - Persist the returned upload ID before sending parts.
- Read bounded chunks, upload them with stable part numbers, and record each returned part identifier.
- Reconcile local parts with the storage service's list-parts result after a restart.
- Complete with the full ordered part list only after the expected parts are present.
- Abort an expired or unrecoverable multipart upload, then close the application record.
The ordering is the point. A process can die after part 17 is accepted and before the database transaction commits. On resume, the worker must compare remote parts with local evidence; uploading every part again wastes bandwidth, while trusting the database blindly can omit an accepted part from completion.
Here is the generic boundary I use in tests and in the storage adapter. It keeps provider details out of retention code. The concrete implementation maps these methods to the S3-compatible API available in the target environment; the application still owns persistence and policy.
type Part = { partNumber: number; etag: string; }; type MultipartStore = { create(key: string): Promise<{ uploadId: string }>; uploadPart(input: { key: string; uploadId: string; partNumber: number; body: Uint8Array; }): Promise<{ etag: string }>; listParts(key: string, uploadId: string): Promise<Part[]>; complete(key: string, uploadId: string, parts: Part[]): Promise<void>; abort(key: string, uploadId: string): Promise<void>; }; async function uploadBackup( store: MultipartStore, key: string, chunks: AsyncIterable<Uint8Array>, savePart: (part: Part) => Promise<void>, ): Promise<void> { const { uploadId } = await store.create(key); const parts: Part[] = []; let partNumber = 1; try { for await (const body of chunks) { const result = await store.uploadPart({ key, uploadId, partNumber, body, }); const part = { partNumber, etag: result.etag }; await savePart(part); parts.push(part); partNumber += 1; } parts.sort((a, b) => a.partNumber - b.partNumber); await store.complete(key, uploadId, parts); } catch (error) { await store.abort(key, uploadId); throw error; } } The savePart call is deliberately after the storage response and before the next part. A production worker can add bounded concurrency, but it must preserve the same fact: a part is resumable only after its identifier is durable. Retry the same (uploadId, partNumber) assignment according to the storage service's documented semantics, and cap retries with backoff. Don't create one promise for every chunk of a multi-gigabyte backup; memory is part of the throughput measurement.
Completion has its own postcondition. Mark the backup available only after completion succeeds, then issue a metadata request and persist the observed size. A successful part response proves one part was accepted. It does not prove that readers can fetch the final object.
What evidence should the recovery ledger retain?
Treat retention as a second clock running alongside transfer. The upload worker leases an uploading record while it works. A reconciler examines expired leases, lists remote parts, and chooses resume or abort from an explicit rule. A request timeout should never decide how long a signed document remains discoverable.
Consider a worker that has accepted parts 1 through 16, then loses its process while part 17 is in flight. The database may contain 1 through 16, the object store may contain 17, and the final object may not exist at all. On restart, a safe reconciler loads the upload ID, asks the storage service for its remote parts, checks the part identifiers it can trust, and records the difference before scheduling work. If the lease has expired, it does not quietly race the old worker. It either renews ownership under an explicit rule or aborts the incomplete upload. After completion, it verifies the resulting object's metadata and records the observed size. At the deletion deadline, another worker uses the same backup ID and key to issue the delete operation, appends the result, and can safely repeat the run. This is more state than a happy-path SDK example shows, but it is the state an audit will ask for.
The deletion worker handles two different things. For a completed object whose deleteAt has passed, it deletes the object and appends an audit event containing the key, deadline, actor, and result. For an incomplete upload past its own retention or lease policy, it aborts the multipart upload. Those are separate actions with separate evidence.
I would test this with a deliberately boring timeline: create the record, kill the worker after a recorded part, restart it, complete the object, advance the clock beyond deleteAt, and run cleanup twice. The second cleanup run should be harmless and should leave a clear event trail. Add a checksum rejection test and a process kill between the complete call and the application update. Those boundaries expose more than a green end-to-end upload.
Encryption and restricted list/read permissions are baseline controls for signed documents. Versioning, replication, legal holds, and provider-specific retention settings can change what “deleted” means. I'm not sure a read-after-delete check alone proves erasure in every deployment; your mileage may vary. Resolve that uncertainty against the target service's documented semantics and a staging test that matches the policy you intend to claim.
When is the simpler upload the better choice?
Multipart is not a badge of seriousness. Use a single request when files are small, uploads are rare, and resending the full artifact is cheaper than operating a reconciliation loop. It is also unsuitable when the storage boundary does not expose multipart operations that your team can monitor and clean up confidently.
Choose client-direct multipart when the application worker cannot sustain the required egress. Choose a managed transfer component when the team cannot own retries, leases, checksums, and cleanup. Stick with a simpler adapter when the team is too small to operate those state transitions; less control can be the honest trade-off.
The right part size and concurrency are measurements, not folklore. Test the real document mix and the slowest important link. Compare sustained throughput, retry behavior, memory use, time to recover after a process kill, and the number of stale uploads left after cleanup. A 64 MiB part and four concurrent transfers may be a useful test point, but they are not universal settings.
That is the decision rule I would ship: multipart for large backups only when the application can persist and reconcile its state; single-request upload for smaller artifacts; client-direct or managed transfer when worker egress or operational ownership is the constraint. The storage API is an implementation detail. The retention record is the contract.


