DEV Community

ZeligHolloway9071
ZeligHolloway9071

Posted on

Compare Cloud Storage Providers for Direct Browser Uploads — A Throughput Matrix

Short answer: To compare cloud storage providers for direct browser uploads, give the browser short-lived presigned URLs, test multipart throughput with 1 GB and 8 GB files, and choose the provider whose CORS, retry, completion, and lifecycle behavior needs the least glue.

For a fintech app accepting private documents, the storage service must keep the browser out of your trust boundary while sustaining the required large-file throughput. That decision comes from a capability matrix, not a universal winner.

Capability S3-compatible object storage What to measure in a proof
Browser authorization Short-lived presigned PUT or multipart URLs Expiry, method, key, and content constraints
Large objects Multipart upload with explicit completion Parts per upload, retry behavior, and completion latency
Browser access CORS policy plus signed download URL Preflight success and expiry enforcement
Retention Lifecycle rules and an application state machine Abort cleanup, quarantine, and deletion timing

My decision rule is plain: test sustained multipart throughput from the users' real regions, then reject any option whose CORS, lifecycle, or abort semantics require application-specific glue. A fast upload that leaves thousands of incomplete parts behind is not fast in production.

How should I compare cloud storage providers for direct browser uploads?

The browser should receive a narrowly scoped capability from the application. The API authenticates the user, creates an object key that does not contain an account number, and signs an upload operation. The file bytes then travel directly to object storage. The API records intent and later verifies the completed object before it becomes available for download.

That split matters for private financial records. A presigned URL is a bearer token. Anyone holding it can use it within its constraints and lifetime, so putting it in a log, analytics event, or error report is a data leak. The URL should be short-lived, single-purpose, and bound to a server-generated key. Never accept a client-supplied destination as the storage key.

CORS is a browser permission layer, not an authorization system. The allowed origin, method, and request headers need to match the actual upload flow. A policy that permits a wildcard origin may make a demo work while weakening the browser boundary. A policy that omits a header used in the signed request fails before the storage service sees the upload. MDN's CORS explanation is a useful reminder that the browser enforces the response headers, not your intentions. I treat this as a contract test because it is easy to miss in a server-only integration test.

Which throughput test survives contact with a real file?

Do not benchmark a 5 MB fixture and call the result “large-file throughput.” Use a fixed dataset that resembles the job: for example, 1 GB and 8 GB encrypted statements, with a checksum recorded before upload. Run the same matrix from at least two user regions and repeat it enough times to show the p50 and p95, not one flattering sample. Keep the network, browser build, concurrency, part size, and object key policy fixed; otherwise a provider comparison quietly becomes a comparison of test harnesses.

Measure it twice.

Measure three clocks separately: time to obtain upload capabilities, time spent transferring parts, and time from the final part to a verified completed object. The second clock is the provider comparison. The first exposes API or signing bottlenecks. The third catches completion behavior that users experience as a stuck upload.

Multipart upload changes the failure model. A dropped connection should retry one part, not restart the object. Part size is a trade-off: small parts improve retry granularity but increase request and coordination overhead; large parts reduce overhead but make a retry expensive. Keep the part map in the client only as transient state, and make the server able to expire an abandoned upload. AWS documents the multipart sequence as initiate, upload parts, and complete or abort; that lifecycle is the useful standard even when the endpoint is S3-compatible.

I would fail a candidate in the test suite for any of these results:

  • a retry silently creates a second object;
  • completion is accepted without checking the expected size or checksum;
  • an interrupted upload has no bounded cleanup path;
  • the browser needs a permanent storage credential;
  • the measured transfer path is fast only from the test runner's region.

Those are capability failures. A lower transfer rate can be handled by tuning concurrency and part size. An unclear ownership boundary cannot.

How should the upload and download paths fit together?

Treat an upload as a state machine, not a successful HTTP response. A useful sequence is created, uploading, uploaded, verified, and rejected. The download link is issued only for verified. This prevents a client from asking for a link immediately after it receives upload URLs and reading an object that has not passed type, size, malware, or business validation.

Here is the shape of the application-facing code. The storage adapter hides provider details; the policy stays in the application.

type UploadState = "created" | "uploading" | "uploaded" | "verified" | "rejected";

type UploadIntent = {
  id: string;
  objectKey: string;
  expectedBytes: number;
  state: UploadState;
  expiresAt: Date;
};

interface ObjectStore {
  createMultipart(intent: UploadIntent): Promise<{ uploadId: string }>;
  signPart(input: { key: string; uploadId: string; partNumber: number }): Promise<string>;
  completeMultipart(input: {
    key: string;
    uploadId: string;
    parts: Array<{ partNumber: number; etag: string }>;
  }): Promise<{ bytes: number; checksum?: string }>;
  abortMultipart(input: { key: string; uploadId: string }): Promise<void>;
  signDownload(input: { key: string; expiresInSeconds: number }): Promise<string>;
}

async function finishUpload(
  store: ObjectStore,
  intent: UploadIntent,
  uploadId: string,
  parts: Array<{ partNumber: number; etag: string }>,
): Promise<UploadState> {
  const result = await store.completeMultipart({
    key: intent.objectKey,
    uploadId,
    parts,
  });

  if (result.bytes !== intent.expectedBytes) {
    await store.abortMultipart({ key: intent.objectKey, uploadId });
    return "rejected";
  }

  return "uploaded";
}
Enter fullscreen mode Exit fullscreen mode

The adapter contract is deliberately small. It gives the CLI or SDK one seam to test without pretending that every provider has identical retry, checksum, or lifecycle behavior. The production test should still exercise each provider's real browser CORS policy and multipart completion path.

Download links need the same discipline. Store the object key and authorization decision in the database; generate the expiring link at request time. Do not store a presigned URL as a durable record. Its expiry is part of the capability, while the database record is the audit trail.

Where do the storage choices diverge?

S3, Cloudflare R2, and Wasabi all offer S3-oriented workflows, but “S3-compatible” is not a throughput or behavior guarantee. S3 is the reference point for multipart semantics and lifecycle configuration. R2 exposes an S3-compatible API and documents presigned URLs, with its own account and endpoint configuration. Wasabi documents presigned URLs through its S3-compatible interface. Those facts establish a usable starting point, not interchangeable operational results.

The practical comparison is narrower than a feature checklist. For each candidate, verify the signing region and endpoint rules, browser OPTIONS responses, supported checksum behavior, multipart limits, abort cleanup, and the time needed for a completed object to become readable on the download path. Record these as automated contract tests. A passing SDK test is insufficient if the browser sends a header the CORS policy does not expose.

The runner-up is better when its network path is materially closer to the uploaders, when its lifecycle controls match the retention policy, or when the team already operates its compatibility layer. A provider with a familiar API can still lose if its measured p95 completion time breaks the product's upload deadline. Conversely, a raw transfer result should not win if legal retention, deletion verification, or audit requirements remain ambiguous.

Prices should be a later filter. The first-order question is whether the system can move and validate large private objects under failure, then delete abandoned state predictably. That is the boundary users feel.

Build the matrix around the file sizes, regions, retry rates, and retention rules you actually have. Select the option that passes those tests with the fewest special cases. The storage brand is incidental; the capability boundary is the design.

References

Top comments (0)