← Blog

Prepare website for high traffic without a rebuild: 8 steps

For CTOs and engineers who must keep a WordPress, Shopify, Webflow or custom site fast through a launch or sale: an eight step plan, with code, that keeps the site you have.

Get a summary withChatGPT Claude Google AI Mode
Bridge widening as light points arrive, a metaphor for how to prepare website for high traffic
On this page

A launch, a sale or a big email send can multiply your traffic within minutes. You do not need a new site to survive it. To prepare website for high traffic, you need the right order: measure, cache, lighten, queue, watch.

This guide is for the engineer or technical lead who owns the site and briefs marketing or e-commerce. It covers WordPress, Shopify, Webflow and custom apps. Each section opens with its outcome, so a marketing lead can follow the plan without the code.

Road lanes opening one by one as light points arrive, showing a site that stays steady as visitors grow
A site that opens more lanes as visitors arrive

Every step changes the site you already run. Where a rebuild would truly help, the last section says so and shows how to replace only the part that fails.

Key takeaways

  • A load test on a staging copy shows your real limit and the first part to give way, before you change anything.
  • Serving anonymous pages from a CDN cache moves most requests away from your origin server.
  • Lighter images and fewer third-party scripts help every visit and keep Core Web Vitals inside Google's good thresholds.
  • Queued background jobs keep checkout and forms fast while emails, ERP syncs and webhooks drain after the peak.
  • Rebuild only the part that fails: when tuning cannot reach the target, replace one layer, not the whole site.

Load test first to prepare for high traffic

A load test shows how many visitors your site serves before it slows down, and which part gives way first. Without it, every later change is a guess. With it, each change is proven by a number.

Run the test against a staging copy, or agree the window with your host first. Never aim it at third-party services such as payment gateways, ERPs or email providers. Their limits are not yours to find.

What to measure before the spike

Start with a target, and plan for the peak minute, not the hourly average. For example (illustrative), a sale page normally gets 300 visits an hour and you expect ten times that after an email send. If 40% of those visits land in the first five minutes, that is 1,200 visits in 300 seconds, about four new visits a second, each loading a page plus its assets.

Measure these during the test:

  • p95 response time: the time within which 95% of requests finish.
  • Error rate: the share of requests that fail or time out.
  • Requests per second the server completes without errors.
  • CPU, memory and database connections on the origin.
  • Cache hit ratio at the CDN, once you add one.

Test your money pages first: the landing page, the product or booking page, and the cart or form that follows.

A first k6 load test you can run today

k6 (opens in a new tab) is an open-source load testing tool where you write the test in JavaScript. The script below ramps virtual visitors up in stages, opens three pages at random and fails the run if errors or slow responses cross your thresholds.

import http from 'k6/http';
import { check, sleep } from 'k6';

export const options = {
  scenarios: {
    sale_spike: {
      executor: 'ramping-vus',
      startVUs: 0,
      stages: [
        { duration: '2m', target: 50 },  // warm-up
        { duration: '5m', target: 200 }, // peak of the forecast
        { duration: '1m', target: 0 },   // ramp down
      ],
    },
  },
  thresholds: {
    http_req_failed: ['rate<0.01'],   // under 1% failed requests
    http_req_duration: ['p(95)<800'], // p95 under 800 ms
  },
};

// Replace with your staging host and money pages
const BASE_URL = 'https://staging.example.com';
const PAGES = ['/', '/sale/', '/product/example/'];

export default function () {
  const path = PAGES[Math.floor(Math.random() * PAGES.length)];
  const res = http.get(`${BASE_URL}${path}`);
  check(res, { 'status is 200': (r) => r.status === 200 });
  sleep(1 + Math.random() * 2); // visitors read before the next click
}

Save it as spike.js and run k6 run spike.js. The thresholds turn the result into a pass or fail. Choose limits that match what you promise visitors, not these example values.

Reading the results and finding the bottleneck

Look for the moment p95 starts to climb as virtual visitors rise. That is your practical limit today. Then read the server metrics for the same minute to see what gave way:

  • CPU pinned on the origin: pages are built on every request, so caching comes first.
  • Database time or connections rising: look for slow queries and autoloaded data.
  • Low CPU but slow responses: the page waits on something external, such as an ERP call or a third-party API.
  • Errors on healthy servers: a rate limit, a connection cap or a firewall rule that treats the test as an attack.

Then repeat this routine until the test passes.

  1. Pick the money pages

    Choose the landing page, the product or booking page, and the cart or form.

  2. Set the target traffic

    Use the peak minute of your forecast, plus a margin.

  3. Ramp the test

    Raise virtual visitors in stages and note where p95 starts to climb.

  4. Find the first bottleneck

    Match the climb to CPU, the database or an outside call.

  5. Fix one thing, then rerun

    One change per run shows you which change paid back.

The next four sections hold the usual fixes, in the order they tend to pay back.

Set up CDN caching for traffic spikes

A CDN (content delivery network) keeps copies of your pages and files on servers near visitors, so most requests never reach your origin. For a page-heavy site this is usually the largest single gain, and it needs no change to your design.

Why it matters

The cheapest request is the one your origin never sees. Cache anonymous pages at the edge, and keep the cart, checkout and account dynamic.

The diagram shows the path. Most visitors are answered from the edge cache. A few misses reach the origin and the database, and their answers fill the cache, so the share reaching the origin shrinks as the cache warms.

CDN request path

  1. 01VisitorsOpen a page on your site
  2. 02CDN edgeChecks its nearby cache first
  • ACache hitMost visitors take this path
    1. Answered at oncePage returns from the edge
  • BCache missFewer as the cache warms
    1. Origin and databaseBuilds the page, then fills the cache

Diagram of a request path where most visitors are answered by the CDN cache and few misses reach the origin

How a CDN cache keeps most requests away from your origin

Cache headers that fit each file type

Headers tell browsers and CDNs how long to keep a response. The web.dev guide to the HTTP cache (opens in a new tab) explains the model in full. In short: give files whose name changes with their content a very long life, and give HTML a short life at the edge with a stale fallback.

# Fingerprinted files only (for example app.3f9c1a.js): cache for a year
location ~* \.(?:css|js|woff2)$ {
  add_header Cache-Control "public, max-age=31536000, immutable";
}

# Anonymous HTML: browsers revalidate, the CDN keeps it for 5 minutes
location / {
  add_header Cache-Control "public, max-age=0, s-maxage=300, stale-while-revalidate=60";
}

The second block lets the CDN keep a page for five minutes (s-maxage=300) and serve a stale copy for up to a minute while it refreshes in the background. Check that your CDN honours s-maxage and the stale directives, because support differs by provider. Images that keep the same file name when edited need a shorter life than a year.

Full-page caching at the edge

Full-page caching stores the finished HTML for anonymous visitors, so your application does not run for each view. On WordPress, a page cache plugin or your host's cache does this, and a CDN with full-page rules extends it to the edge. Shopify and Webflow cache pages through their own CDN.

Three habits make it work in practice:

  • Purge by URL when content changes, so editors see updates without clearing everything.
  • Ignore marketing parameters such as utm_source in the cache key, so every campaign link hits the same cached page.
  • Warm the cache before the event by requesting your key URLs once, so the first real visitors get a hit.

Keep cart, checkout and account dynamic

Pages that depend on the visitor must reach the origin, or visitors could see each other's data. Bypass the cache when a request carries a session or cart cookie. On WooCommerce, for example, that means cookies such as woocommerce_items_in_cart and wordpress_logged_in_.

Then keep those routes light. A fast cart and checkout is where lost seconds cost sales, so let the cache absorb everything else and leave the origin's capacity for them.

Trim images and scripts before high traffic arrives

Lighter pages cost your server and your visitors less. Fewer bytes also mean your CDN and origin can serve more visits in the same minute.

Responsive, compressed images

Images are usually the heaviest part of a page. Serve AVIF or WebP, give each image several widths so phones download the small one, and set width and height so the layout does not jump. Lazy-load images below the fold, but load the hero image first.

<!-- Hero image: the largest element above the fold, so it loads first -->
<img
  src="/img/hero-1200.avif"
  srcset="/img/hero-600.avif 600w, /img/hero-1200.avif 1200w"
  sizes="(max-width: 700px) 100vw, 1200px"
  width="1200" height="630"
  fetchpriority="high"
  alt="Spring sale collection">

Third-party scripts and tag audit

Every tag, chat widget, heatmap and review badge calls a server you do not run. When that server slows down, your page waits. List every script in your tag manager and in the theme, and ask who uses each one this quarter.

Remove what nobody reads. Defer what can wait until the visitor interacts, such as chat. For the rest, load the script only on the pages that need it.

Core Web Vitals targets to hold under load

A page that is fast with ten visitors can slow down with a thousand, so test these targets during the load test as well. Google measures them at the 75th percentile of real visits, as the web.dev Web Vitals guide (opens in a new tab) explains.

2.5s

LCP target

How fast the main content appears, Google's good threshold

200ms

INP target

How fast the page answers a tap, Google's good threshold

0.1

CLS target

How stable the layout stays, Google's good threshold

If LCP rises as virtual visitors rise, the server is slow to answer. If INP rises, too much script is running in the browser.

Audit the WordPress database and plugins

On WordPress, the first things to give way under load are usually the database and one or two plugins. You can fix both in place, which is why a rebuild is rarely the first answer.

Object cache and page cache

The page cache serves finished HTML to anonymous visitors. A persistent object cache, usually Redis or Memcached, keeps the results of repeated database queries between requests. It helps most on logged-in and dynamic pages, such as WooCommerce carts. It needs support from your host, so ask before you plan around it.

Slow queries and autoloaded options

WordPress loads every autoloaded option from wp_options on every request. Years of plugins can leave megabytes there. This query lists the largest ones. Adjust the table prefix if yours is not wp_and run it on staging first.

-- Largest autoloaded options (WordPress 6.6 and later also uses 'on' and 'auto-on')
SELECT option_name, LENGTH(option_value) AS bytes
FROM wp_options
WHERE autoload IN ('yes', 'on', 'auto-on', 'auto')
ORDER BY bytes DESC
LIMIT 20;

For slow queries, run Query Monitor on staging while you click through the money pages, or read the MySQL slow query log during the load test. Fix the worst query first, then rerun.

Plugins to remove, replace or isolate

Deactivate plugins one at a time on staging and rerun the test. The one that moves p95 most is your first candidate. Remove it if nobody needs it, replace it with a lighter option or a few lines of custom code, or isolate it so its scripts load only on the pages that use it.

Also replace the visitor-triggered WP-Cron. Set define( 'DISABLE_WP_CRON', true ); in wp-config.php and call wp-cron.php from a system cron every minute. Scheduled work then stops competing with visitors.

What Shopify and Webflow already handle

On Shopify or Webflow, the platform runs hosting, the CDN and scaling, so your work is the part you control. The risk moves from servers to the code and scripts you add on top.

Shopify: hosting is covered, theme and apps are yours

On Shopify, the platform hosts the store and runs checkout. Your theme code, installed apps and third-party scripts still decide how fast each page feels. A theme that makes many Liquid calls or an app that injects heavy scripts slows every visit, however well the platform scales.

Audit apps before a sale and remove those you do not use. Test any custom app endpoint or webhook receiver you run yourself, because that part is yours. Check the Shopify documentation for current platform limits before you plan.

Webflow: CDN hosting and custom code

Webflow serves your pages from its CDN. What stays with you is custom code, embeds, third-party forms and scripts, and heavy pages. Keep them lean and test the pages that carry them. For the hosting model in detail, read Webflow architecture explained: hosting, CDN, security and performance.

Which platform handles which layer

Hosted

Shopify

  • Hosting and CDN: Shopify
  • Yours: theme code, apps, scripts, custom endpoints
  • Test: collection and product pages, cart, app calls

Hosted

Webflow

  • Hosting and CDN: Webflow
  • Yours: custom code, embeds, third-party forms and scripts
  • Test: heavy pages, embeds, webhook integrations

Most tuning needed

WordPress

  • Hosting and CDN: your host and your CDN
  • Yours: plugins, database, caching, PHP settings
  • Test: full load test plus a database review

The more the platform runs, the shorter your list. The load test still tells you where your list starts.

Handle traffic spikes by queueing heavy tasks

A queue keeps checkout and forms fast by letting slow work finish after the visitor has their answer. Emails, ERP syncs and PDFs then drain after the peak instead of during it.

The diagram shows the idea. Orders arrive in a burst, the site replies at once, jobs line up, and workers drain them at a steady pace, retrying any that fail.

Queue under load

  1. 01Order burstMany checkouts arrive at once
  2. 02Site repliesVisitor gets an answer at once
  3. 03QueueEmail, ERP sync, PDF, webhook wait here
  4. 04WorkersDrain jobs at a steady pace
  5. 05DoneFailed jobs retry until they pass

Diagram of a job queue where orders arrive in a burst, the site replies at once and workers drain jobs with retries

A queue lets checkout reply fast while slow jobs drain after the peak

Which tasks to take off the request path

Use one rule: if the visitor does not need the result to see the next page, queue it. That usually covers:

  • Order confirmation and marketing emails.
  • ERP and CRM syncs.
  • PDF invoices and quotes.
  • Webhooks to third-party services.
  • Image processing and analytics events.

Retries, rate limits and idempotency

Background jobs fail sometimes, so retry them with a growing delay. Respect the rate limit of the service on the other side, such as your ERP, and let workers drain at its pace. Give each job an idempotency key, a unique ID stored when the job first runs, so a retry never creates two orders in the ERP.

Queue options by platform

PlatformQueue optionWhat to check
WordPress and WooCommerceAction Scheduler, run by a real system cronCron runs every minute, failed actions are reviewed
ShopifyWebhooks received by your endpoint, which replies at once and queues the workThe endpoint replies fast and handles repeated events
WebflowForm or CMS webhooks sent to an n8n workflow or a small queue serviceRetries on failure, no lost submissions
Custom (Next.js)A job queue such as BullMQ on Redis, or a managed queue from your cloud providerWorker count and failed job handling

If your origin runs on a cloud provider, the cloud scalability guide for AWS, GCP and Azure covers autoscaling workers and managed queues.

Monitor, alert and run a pre-launch checklist

During the event, you want to see trouble before visitors feel it and to know who acts. A short list of alerts and a rehearsed rollback give you that.

Metrics and alerts worth setting

Alert on what visitors feel, and give every alert an owner and a channel:

  • Error rate: the share of 5xx responses, against your normal baseline.
  • p95 response time on the money pages.
  • Cache hit ratio at the CDN. A sudden drop means a purge or a rule is sending traffic to the origin.
  • Origin CPU, memory and database connections.
  • Queue depth and the age of the oldest job.
  • A business signal: orders or form submissions per minute.
  • An uptime check from outside your own network.

A rollback and freeze plan

Freeze changes to themes, plugins and deployments from a set time before the event, for example 48 hours. Keep a tagged release and a fresh backup of files and database. Rehearse the rollback once on staging so nobody improvises on launch day.

Prepare one quick switch for the heaviest optional feature, such as a recommendations block or a chat widget. If the load test shows it is the first to strain, you can turn it off in seconds.

The pre-launch checklist

Run this in the last week.

  • Baseline load test passed at your target traffic, with margin
  • Cache hit ratio checked on the money pages
  • Images compressed and third-party scripts trimmed
  • Heavy tasks moved to a queue with retries
  • Alerts set and one named owner on call during the event
  • Rollback rehearsed and a recent backup confirmed
  • Change freeze agreed with everyone who can publish or deploy
  • Contact plan ready for telling customers if something slows

Share the list with marketing and e-commerce as well. They own the send time and the promotion, which are the inputs to your forecast.

When a rebuild is the right call

Tuning has a ceiling. If you reach it after the steps above, a rebuild is a sound decision, and a smaller one than it first sounds.

Signs the architecture is the limit

After caching, trimming and queueing, look for these signals in the load test:

  • Most requests must be personalised, such as logged-in dashboards, so the origin does the work every time.
  • The data model forces slow queries that indexes and caches cannot fix, for example checkout writes that lock the same table.
  • Your platform's documented limits sit below your target and the fix is not yours to make.
  • Nobody can change the code safely, so each fix risks a new outage.

If two or three apply, the architecture is the limit, not the tuning.

Rebuild only the part that fails

Replace one layer at a time. Put the failing part, such as search, the catalogue or checkout, behind a new service while the rest of the site stays as it is. If a framework move is on the table, ultra-fast websites with modern frameworks compares Next.js, Astro and Remix.

Building with one glowing section being replaced while the rest stands, showing a partial rebuild
Replace the layer that fails and keep the rest

This keeps your SEO, your content and your team's habits, and it turns a large risk into a series of small, testable ones.

Where to start this week

Run a baseline load test of your three money pages on a staging copy. Use the k6 script above and write down the p95 and the traffic at which it starts to climb. That one number tells you which of the steps in this guide to do first.

If you would rather not carry it alone, tell us your launch date and your target traffic. Our performance work before a campaign follows the same loop: measure, fix the biggest bottleneck, rerun, and report each month in writing. You get a reply in under 2 hours on business days.

Frequently asked questions

How do I prepare my website for high traffic?

Run a load test on a staging copy to find your limit, then cache pages at a CDN, compress images, trim third-party scripts and move heavy tasks into a queue. Before the event, set alerts and a rollback plan.

How much traffic can my website handle?

It depends on your hosting, platform and page weight, so only a load test gives the real figure. Raise virtual visitors until p95 response time or errors cross your threshold. That point is your current limit.

What is the best tool for website load testing?

k6 is a good starting point: it is open source, tests are written in JavaScript and thresholds pass or fail a run. JMeter, Locust and Gatling are also widely used. Choose the one your team will keep running.

Does a CDN help with traffic spikes?

Yes, when it caches your pages and files, because most requests are answered at the edge and never reach your origin. Pages that depend on the visitor, such as cart and checkout, must still reach the origin.

How do I scale a WordPress site without rebuilding it?

Add a page cache and a CDN, a persistent object cache, then clean autoloaded options and slow queries. Remove or replace the heaviest plugins, move background work into a queue and load test after each change.

Does Shopify handle traffic spikes automatically?

Shopify runs the hosting, CDN and checkout infrastructure. Your theme code, apps, scripts and integrations still affect speed, so test them before a sale and check Shopify's documentation for current limits.

When should I rebuild a site instead of optimizing it?

Rebuild when caching, lighter pages and queues have been applied and the load test still misses your target because of the architecture. Typical causes are personalised pages, a data model that blocks queries and code nobody can change safely. Replace the failing layer first.

Running into this on your own stack?

Tell us the platform and the problem. We'll tell you what it takes and who does it.

Start a conversation No commitment. Just a conversation.