Large backup files should move directly from a media producer to S3-compatible object storage, while a small application ledger governs who may resume, complete, or abort each multipart upload. That split is the practical answer when throughput matters: the application does not become a byte proxy, yet every state change remains attributable and replayable.
Control first.
Short answer: use multipart upload with an append-only audit record, idempotency keys, and a reconciliation step before completion. The storage service owns received bytes; your backup domain owns tenant identity, retention intent, and the decision to publish an object. This is an exactly-once mindset applied to control decisions, not a promise that networks deliver bytes exactly once.
The example here is a media archive producer exporting a 420 GiB camera-original set. It has to survive a worker restart and a provider migration without quietly producing two logical backups. I care about that distinction because a successful HTTP response is not evidence that a restore is semantically usable.
Cost evidence belongs in the migration contract
Before choosing concurrency, write the invariants in the architecture decision record. One logical backup generation gets one immutable object key. Every accepted part receipt records its number, size, returned identifier, and whatever checksum evidence the protocol supplies. Completion and abort are competing state transitions on one versioned ledger row, and an idempotency key returns the prior decision when a client retries.
The ledger is not a mirror of object storage. It is the authority for authorization and intent. A remote part listing can tell you that bytes exist, but not which tenant requested them, which retention policy applies, or whether those bytes belong to the current generation. Keep the storage upload identifier encrypted at rest and bind it to the tenant and key; never let an untrusted caller nominate either value as proof of ownership. During a migration, carry this domain record across adapters even when provider response formats differ: preserve opaque part identifiers, checksum evidence, object identity, retention intent, and the idempotency key, but expose none of the provider's incidental fields to backup jobs. That separation lets a rehearsal restore the same logical generation from two endpoints and compare bytes, metadata, and audit decisions rather than comparing SDK structs.
Audit trails have limits. Application events explain what the control plane decided, while provider logs explain what the storage service observed. Neither proves that a restored media file decodes correctly. Compliance teams still need a jurisdiction-specific mapping for retention, deletion, access evidence, and key management. I’m not sure any universal retention interval is defensible, so make the interval configurable and record who changed it.
Can teams measure large app backup file multipart upload in Node.js object storage?
Treat resume as a reconciliation workflow, not as “continue from the last callback.” Suppose the producer transmitted part 317 and lost the response. The ledger may end at 316 while storage already has 317. On restart, compare the durable manifest with observed parts, verify the number and integrity evidence, and adopt only an exact match. Otherwise issue fresh authorization and retransmit that part. Do not infer success from a local log line.
Node.js can coordinate this control path without buffering the entire archive. A worker streams a bounded part into a direct upload request, records the returned identifier transactionally, and limits in-flight parts according to measured memory and network capacity. The following Go example is deliberately language-agnostic in its interfaces while showing the critical completion boundary; the same state machine can sit behind a Node.js handler.
package archive
import (
"context"
"errors"
"sort"
)
type Part struct {
Number int
Identifier string
SizeBytes int64
}
type Upload struct {
ID string
ObjectKey string
StorageUploadID string
Version int64
Parts []Part
}
type Repository interface {
BeginCompletion(context.Context, string, string, int64) (Upload, error)
MarkComplete(context.Context, string, string, string) error
}
type ObjectStore interface {
Complete(context.Context, string, string, []Part) (string, error)
Observe(context.Context, string, string) (string, bool, error)
}
var ErrIncompleteManifest = errors.New("part manifest is not contiguous")
func CompleteUpload(ctx context.Context, repo Repository, store ObjectStore, id, key string, version int64) error {
upload, err := repo.BeginCompletion(ctx, id, key, version)
if err != nil {
return err
}
parts := append([]Part(nil), upload.Parts...)
sort.Slice(parts, func(i, j int) bool { return parts[i].Number < parts[j].Number })
for i, part := range parts {
if part.Number != i+1 || part.Identifier == "" || part.SizeBytes <= 0 {
return ErrIncompleteManifest
}
}
identity, err := store.Complete(ctx, upload.StorageUploadID, upload.ObjectKey, parts)
if err != nil {
observed, complete, observeErr := store.Observe(ctx, upload.StorageUploadID, upload.ObjectKey)
if observeErr != nil || !complete {
return err
}
identity = observed
}
return repo.MarkComplete(ctx, upload.ID, key, identity)
}
The remote completion and local commit cannot be one database transaction. If the caller times out after the remote service accepts the manifest, a retry with the same operation key should observe the remote result and converge on one terminal record. That is why completing is a durable state, not a transient in-memory flag.
Failure evidence before migration: what travels?
Migration changes the evidence you need. Keep a provider-neutral adapter that preserves opaque upload identifiers, part checksums, and final object identity, while the domain record stores only stable concepts. Run a black-box conformance suite against every candidate endpoint: initiate, upload out of order, repeat a part number, lose the completion response, list observed parts, race abort with complete, and read the resulting object back.
| Design | Bulk byte path | Migration evidence | Where it fits | Limitation |
|---|---|---|---|---|
| Direct multipart plus ledger | Producer to storage | Manifest and audit records travel with the domain | Large archives and resumable workers | Requires cleanup and reconciliation code |
| Application-proxied multipart | Producer through app | Logs are centralized but include the byte path | Small controlled networks | App bandwidth and connection lifetime become bottlenecks |
| Single-request upload | Producer to storage | One request result | Bounded objects | A failed large transfer has coarse retry granularity |
| Managed transfer component | Component-defined | Export and restore its state explicitly | Teams with limited storage operations capacity | Tenant and retention semantics still need integration |
An S3-compatible label is a useful starting point, not a behavioral guarantee. Your test suite resolves uncertainty about ordering, abort races, checksum handling, and completion retries. Keep the suite in CI and repeat it during a migration rehearsal; a green unit test against a mock cannot establish those boundaries.
Rollout choice: why proxying every byte was rejected
Proxying looked attractive because authentication and progress reporting sat in one request handler. It made the control plane easy to sketch and the data plane expensive to operate: a 420 GiB archive crossed the application boundary twice, and a worker restart coupled recovery to a long-lived connection. The option is still suitable for small objects, private networks that forbid direct egress, or transformations that must inspect bytes before storage. It is a poor default for high-throughput media backups.
Part size and concurrency deserve measured choices. Larger parts reduce request overhead but make retries more expensive; smaller parts improve retry granularity but increase manifest volume. Capture throughput, retry count, completion latency, time-to-first-part, and abandoned bytes with representative media. Your mileage may vary across regions and runtimes. Three words: measure first.
Top comments (0)