Concept 13 of 14Build and scale

Performance and scale for large sites

Designing for millions of users: LWR publishing and caching, CDN, page weight, efficient data access, external sharing at scale, login spikes, limits, and load testing.

Your confidence:Not rated

Simple explanation

Front end

  • LWR sites serve published pages statically with caching and CDN delivery.
  • Keep pages light: fewer components above the fold, lazy loading, optimised images.
  • Use cacheable Apex and LDS for read-mostly data.

Data and sharing

  • Sharing sets for high-volume users (no role hierarchy growth).
  • Spread users across accounts; avoid very large accounts with thousands of users or millions of child records.
  • Selective queries with indexes; avoid querying large tables on every page load.

Traffic patterns

  • Plan for spikes (bill runs, product launches, incidents) with load tests in a full sandbox.
  • Back-end callouts need timeouts and caching so slow systems don't slow the site.

Limits: site page views, API calls and other org limits apply βš‘ verify current site limits.

Real-world analogy

A large site is a stadium on match day. Pre-printed programmes (published LWR pages) are handed out instantly, turnstiles are spread around the ground (users spread across accounts), and the kitchen must keep up with half-time rushes (load testing and caching).

Worked example

A tax authority's portal expects 10Γ— normal traffic in the week before the filing deadline. The team built on LWR, made all reference data cacheable, used sharing sets, moved document generation async, cached slow back-end lookups in middleware, and load-tested at peak volume in a full sandbox.

Diagram

Rendering diagram…

Key points

  • LWR + CDN for fast page delivery.
  • Light pages, cacheable data access.
  • Sharing sets and spread accounts for scale.
  • Timeouts and caching for back-end calls.
  • Load test peaks in a full sandbox.

Limits and gotchas

  • Uncached Apex on every page view multiplies queries under load.
  • Large account skew with external users slows sharing operations.
  • Load tests against production need Salesforce's prior agreement; test in sandboxes βš‘ verify policy.

🎀 How to say this in an interview

For "millions of users" questions, cover front-end delivery, data access, sharing model and back-end resilience, then load testing.

Common follow-ups

What happens to the site if SAP is slow during a bill run?

Callouts time out quickly, cached or summary data is shown with a timestamp, and non-urgent requests are queued; the site stays responsive.

How do you load test a site?

In a full or partial sandbox with production-like data, using a load testing tool simulating peak logins and page views, measuring response times and limits, after agreeing the test with Salesforce if required.