Skip to content

E-commerce load testing before Black Friday

B2Bnetwork team · · 6 min

System performance

In brief

Load testing an online store before Black Friday checks more than whether pages open. It checks whether, at peak traffic, a customer can find a product, add it to the cart and pay. In stores the first things to fail are usually search, the cart with promotion recalculation, stock reservation and calls to the payment gateway. The test has to be built around those points: with a traffic wave after a newsletter, a cold cache after a deployment and many customers buying the same product.

Why store traffic differs from internal systems

Traffic in a store on a promotion day does not grow evenly. It comes in waves: at midnight, after the newsletter goes out, after a push notification, when an ad campaign starts. Within minutes the number of new sessions can multiply, and people do not wait for the system to warm up. That is why a store is tested with an open workload model, where what matters is the arrival rate of customers, not a fixed number of users. Tools such as k6 have an executor for exactly this, with a constant or ramping arrival rate.

The second difference is the mix. On an ordinary day most traffic is browsing categories and product pages. During a promotion the share of search, cart and checkout grows, and those operations write to the database and call external systems. A traffic model from the previous peak is therefore better than one from an ordinary week. The general preparation plan is covered in Performance testing before a sales peak. Here we focus on what breaks most often in a store.

Five places that break first

PlaceWhat happens at peakWhat to check in the test
Search and filtersqueries with many filters bypass the cache, the search engine saturates CPUrare filter combinations, typos, sorting by price
Cart and promotionsevery cart change recalculates discount rules, codes and free shipping thresholdsa cart with many items and several promotions at once
Stock reservationmany customers buy the same product, locks on a single database rowseveral hundred orders for one product in a short time
Paymentthe gateway responds more slowly, threads wait, the connection pool runs outa payment gateway stub with latency and errors
ERP and warehouse integrationstock and order synchronization falls behind, the queue growsqueue length and order handover time

Stock reservation deserves its own test. During a promotion on a single product, hundreds of orders try to change the same stock record. In a regular test, where each virtual customer buys a different product, the problem stays hidden. You have to direct traffic at a few products on purpose and watch lock wait times in the database. When the store exchanges stock levels with an ERP system, also check whether the order queue keeps up. How to build that integration is covered in Integrating an online store with ERP.

Cache, CDN and cold start

A store survives its peak thanks to caching: the CDN serves images and category pages, and the application caches product pages and prices. Test results with a warm cache look great. The trouble starts when the cache is empty: after a morning deployment, after switching to promotional prices at midnight or after a CDN purge. Then all traffic hits the application and the database at once.

So the test series should include two runs of the same profile: one with a warm cache and one right after clearing it. The difference in response times and database load shows whether you can deploy changes on promotion day and whether the midnight price change will take the store down. How cache invalidation and the thundering herd effect work is covered in Application caching.

The second source of surprises is bots: price comparison crawlers, availability checkers and automated traffic before a product launch. Check in the logs from the previous peak what share of traffic they made up and include them in the model.

The test series step by step

  1. Baseline test with a single user on each journey: the reference point for response times.
  2. Load test of the forecast peak with an open model and the mix from the previous promotion.
  3. Wave test: a jump in arrival rate within a few minutes, as after a newsletter.
  4. Cold cache test: the same profile right after clearing the cache.
  5. Single product test: most orders going to a few promotional items.
  6. Stress test above the forecast, to see where the limit is and how the store behaves past it.
  7. Rerun after fixes, plus an endurance test of several hours if the promotion lasts a whole day or weekend.

Each test needs thresholds: p95 response time for search, add to cart and placing the order, plus the error rate. Also look at what customers see in the browser. Core Web Vitals, especially responsiveness after a click, get worse at peak partly because of third-party scripts, as described in Core Web Vitals.

A plan for promotion day

The test gives you numbers, but on promotion day you also need a plan. Agree with the team who watches which indicators, what the alert thresholds are and what you do when they are crossed: switching off recommendations, simplifying search, a waiting room page before entering the store. Freeze deployments a few days before the promotion and do not change the cache configuration on peak day without a test.

How such preparation runs is shown in the case study Preparing an online store for Black Friday: load tests and a capacity plan. At B2Bnetwork, performance testing for stores is built on a traffic model from last season's logs, and we test the whole chain: the site, APIs, the database and integrations.

Questions and answers

How long before Black Friday should store load testing start?

Early enough to fit at least two rounds of fixes and reruns before the deployment freeze. The first test usually finds several problems, and every fix needs confirming with another run. Starting a few days before the promotion gives you only a measurement, with no time to fix anything.

Can we test in production at night?

You can, if the store has a window with very low traffic and the test does not create real orders, payments or shipments. You need to tag test traffic, cut off the payment gateway and customer emails, and agree the test with your hosting and CDN providers. Testing in an environment with the same configuration is usually safer.

What if the payment gateway does not allow load testing?

Replace it with a stub that responds with latency and an error rate similar to the real gateway at peak. The test then checks whether the store copes with slow or unreliable payments: whether threads hang, whether the customer sees a message and whether the order is left in an undefined state.

Is cloud autoscaling enough for Black Friday?

Not always. New instances need time to start, and the wave after a newsletter arrives within minutes. Autoscaling also does not help when the bottleneck is the database, locks on stock levels or the payment gateway. The wave test shows whether scaling keeps up and suggests how many instances to start in advance.

What it looks like in a project

Your system slows down under load? We'll find where it loses time.

Let's talk

Read more: System performance

All in System performance →