Back to the archive
Ecommerce Performance

The Invisible Payload Tax: Brotli, JSON, and Ecommerce Transfer Budgets

Audit ecommerce text compression across HTML, CSS, JavaScript, JSON, SVG, APIs, cache variants, CPU cost, and mobile transfer performance.

An ecommerce operator reviewing performance metrics on a laptop.

What ecommerce performance reviews often miss is the difference between what a resource contains and what the shopper actually downloads. A 300 KB JSON response may cross the network as a much smaller compressed payload—or it may arrive almost uncompressed because an API route, edge rule, MIME type, or cache variant is wrong.

Text compression is not glamorous, but it affects product HTML, theme CSS, JavaScript, search suggestions, filter responses, cart data, localization dictionaries, and SVG icons. The correct ecommerce performance analysis measures transfer size, compression coverage, origin CPU, cache behavior, and the user-visible work after decompression.

Developer reviewing ecommerce network performance

Table of contents

Why compression needs an ecommerce operating model

Browsers advertise supported encodings through Accept-Encoding; servers or CDNs can return a compressed representation and identify it with Content-Encoding. MDN’s Content-Encoding reference documents encodings such as br for Brotli and gzip.

The operational problem is coverage. Static theme assets may be compressed correctly while dynamically rendered HTML, GraphQL responses, app proxies, search APIs, or regional edge paths are not. A homepage audit can therefore pass while mobile product discovery still transfers avoidable text.

PayloadWhy it growsCompression concern
HTMLpersonalization, app markup, product optionsdynamic response may bypass edge compression
CSStheme history, page builders, app styleslarge shared file may hide route waste
JavaScriptapps, analytics, recommendationssmaller transfer does not reduce parse cost
JSONvariants, search, filters, localizationmissing MIME coverage or oversized fields
SVGicon sets and inline artworkrepetitive markup compresses well but may be duplicated
feeds/XMLproduct and integration exportsbatch size and origin CPU can dominate

Compression reduces network bytes; it does not remove unused code, database latency, JSON parsing, JavaScript execution, or oversized DOM work. Use it as one layer in the RUM-to-revenue scorecard, not as a substitute for payload reduction.

Inventory the payloads that matter

Capture a cold-cache journey across landing, collection, search, PDP, cart, and checkout entry. Repeat it for a returning visit, priority locales, logged-in state, and representative mobile networks. Export response headers and both resource size and transfer size.

For every response, record:

  • URL pattern, route type, status, method, and content type.
  • Uncompressed resource size and compressed transfer size.
  • Content-Encoding, Vary, cache status, and cache-control policy.
  • Origin versus edge response, region, and personalization state.
  • Server timing, compression time where observable, and total response time.
  • Whether the payload blocks render or a purchase-critical interaction.

Do not test only JavaScript bundles. Commerce-specific APIs can be frequent and latency-sensitive: autocomplete results, collection filters, variant availability, delivery estimates, cart mutations, and market configuration.

Journey stepCritical text responseFailure signal
LandingHTML and critical CSS/JSlarge transfer before LCP
Searchsuggestion JSONlatency rises with query breadth
Collectionfilter and sort responsemobile data grows per interaction
PDPvariant and inventory JSONselection waits on oversized state
Cartcart and delivery responserepeated full-state payloads
Market switchtranslations and price datafull locale dictionaries load globally

Measure coverage and useful savings

Build a route-level compression scorecard. Site-wide averages hide the routes with the highest traffic or commercial value.

  • Compression coverage: eligible text bytes served compressed / all eligible text bytes.
  • Transfer reduction: 1 − compressed bytes / uncompressed bytes.
  • Critical-path compressed bytes: text bytes transferred before the primary content or action is ready.
  • API bytes per action: total response bytes for one search, filter, variant, or cart action.
  • Cache variant hit rate: compressed responses served from edge cache / eligible compressed requests.
  • Origin compression CPU: compute time used to encode dynamic responses.

Classify findings by action:

PatternLikely causeCorrect response
no encoding on large JSONMIME type or API bypassenable at the correct proxy/edge layer
Brotli on static, gzip on dynamicplatform policy or CPU tradeoffbenchmark rather than forcing one rule
strong transfer reduction, slow interactionparse or execution work remainsreduce fields and client work
cache misses by encodingincorrect variant handlingreview Vary: Accept-Encoding and CDN keys
tiny responses compressed dynamicallyoverhead exceeds benefitset an evidence-based minimum size
already compressed media reprocessedbroad content-type ruleexclude unsuitable formats

Use percentiles by region and device. A small byte saving can matter on a high-latency mobile path, while aggressive dynamic compression may cost more CPU than it saves on a fast internal API.

Choose Brotli, gzip, and compression levels deliberately

Brotli often produces smaller text representations than gzip, especially when static assets can be compressed ahead of time. Gzip remains a practical fallback and may be cheaper for dynamic responses at some settings. The choice is not simply “Brotli on.” It includes content type, response size, cacheability, compression level, CPU budget, and latency target.

For static versioned assets:

  1. Minify first and remove unused content.
  2. Generate compressed variants during build or at the CDN.
  3. Use content-hashed URLs and long-lived caching.
  4. Serve the encoding the client supports.
  5. Verify that deploy tooling actually uploads the compressed representation.

For dynamic HTML and JSON:

  1. Benchmark encoding time under realistic concurrency.
  2. Avoid high compression levels that increase time-to-first-byte during peaks.
  3. Skip very small responses where headers and CPU erase the benefit.
  4. Cache safe representations at the edge where personalization rules allow.
  5. Reduce response shape before relying on compression.

Never compress sensitive responses indiscriminately without a security review. Compression can interact with secrets and attacker-controlled input in ways that create side-channel risk. Keep secrets out of reflected responses and follow platform security guidance.

Protect caching, APIs, and peak capacity

Encoding negotiation creates variants. Caches need to understand that a Brotli response and an uncompressed response are not interchangeable. Check Vary: Accept-Encoding, CDN cache keys, origin behavior, and whether intermediate proxies normalize headers correctly.

Test these conditions:

  • Browser requests br, gzip, gzip only, and no supported compression.
  • Edge hit and edge miss in each priority region.
  • Anonymous and personalized HTML.
  • Successful, validation-error, and server-error API responses.
  • Peak concurrent search or filter traffic.
  • Deployment immediately after asset invalidation.
GuardrailOwnerRelease check
no wrong-encoding cache responsesPlatformvariant matrix passes
dynamic TTFB stays within budgetBackendpeak load test passes
search/cart APIs remain completeCommerce engineeringschema and action tests pass
parsing and main-thread work do not growFrontendRUM and lab checks pass
origin bandwidth and CPU remain stableInfrastructurecapacity dashboard reviewed

Compression is especially valuable during traffic peaks, but only if it reduces bandwidth without turning origin CPU into the new bottleneck. Pair the change with the CDN and origin-load resilience framework.

A composite operator scenario

Consider a composite retailer whose static storefront assets receive Brotli correctly. The team assumes compression is complete. A mobile journey audit reveals that collection filters call an app-proxy endpoint returning a large uncompressed JSON document containing unused product fields. Each filter action repeats the transfer, and the endpoint misses edge cache because responses are user-agnostic but not marked safely cacheable.

The team first reduces the response schema, then enables suitable compression at the proxy layer and tests cache behavior by encoding. It compares transfer size, TTFB, parsing time, filter response latency, origin CPU, and mobile completion. This sequence matters: compressing an unnecessarily large response would save bandwidth while preserving waste.

The finding also changes governance. New API routes must declare response schema, content type, compression owner, cache policy, expected size, and a performance budget before release.

EcomToolkit’s point of view

Text compression is infrastructure hygiene, not a one-time checkbox. The valuable question is whether every important route sends only the necessary data, with an appropriate encoding, from the right cache layer, without moving delay into CPU or parsing.

Use the network and device performance segmentation guide to find the users who benefit most. If static assets pass audits but dynamic commerce journeys remain heavy, Contact EcomToolkit for an HTML, API, cache-variant, and transfer-budget review.

Related partner guides, playbooks, and templates.

Some resource pages may later use partner links where the tool is genuinely relevant to the topic. Recommendations stay contextual and route through internal guides first.

More in and around Ecommerce Performance.

Free Shopify Audit

Get a free Shopify audit focused on the fixes that can move revenue.

Share the store URL, the blockers, and what needs attention most. EcomToolkit will review UX, CRO, merchandising, speed, and retention opportunities before replying.

What you get

A senior review with the priority issues most likely to improve performance.

Best for

Brands planning a redesign, migration, CRO sprint, or retention cleanup.

Reply route

Every request is routed to info@ecomtoolkit.net.

We use these details to review your store and reply with the next best steps.