HIGH-LOAD SCALING•
Top E-Commerce Fashion & Retail (EU)
•
6 min read

Scaling a Transactional Engine to 65k CCU During Black Friday

Overhauling an e-commerce platform from HTTP 504 outages at 12k CCU to flawless execution of 65k CCU during Black Friday peak via RoadRunner, RabbitMQ, and Redis sharding.

Peak throughput
65,000 CCU12,000 CCU (crash)
+440%
Transaction p99 latency
24.5 ms1,450 ms
-98.3%
Dropped orders
0.000%4.8% (504 errors)
Zero loss
PHP 8.3RoadRunnerPostgreSQLRabbitMQRedis ClusterKubernetes

Business Context & The Scalability Wall

A leading European Fashion & Retail marketplace was heading into the Black Friday / Cyber Monday holiday shopping peak facing a critical scalability barrier.

Their existing monolithic architecture—built on a standard PHP-FPM stack and relational PostgreSQL database—began throwing HTTP 504 Gateway Timeout errors at just 12,000 concurrent users (CCU).

Primary Failure Symptoms:


Architectural Diagnosis & Bottlenecks (APM Profiling)

We initiated the engagement with an intensive 14-day Audit Sprint. Leveraging APM distributed tracing and pg_stat_statements analysis, we isolated three critical contention points:

  1. Synchronous Checkout Chain: A single "Place Order & Pay" click triggered 14 sequential SQL queries, synchronous third-party payment gateway validation, and an external ERP inventory lookup.
  2. Absence of Cache Stampede Safeguards: Key expiration on viral promotional product pages hammered the PostgreSQL disk layer simultaneously (Thundering Herd effect).
  3. Connection Management Starvation: The lack of an optimized connection pooler (such as PgBouncer) pushed the database past its 800 concurrent connection ceiling.

Applied Engineering Solutions

Rather than embarking on a high-risk "Big Bang Rewrite" from scratch, we architected and deployed a resilient transactional hybrid model while the live storefront operated without interruption:

1. Migrating to RoadRunner Runtime (Worker Pools)

We replaced standard PHP-FPM with RoadRunner, a high-performance application server written in Go. The application runtime resides persistently in RAM, dropping per-request bootstrap overhead from 45 ms down to 1.2 ms.

2. Event-Driven Architecture (Asynchronous Checkout)

The order confirmation sequence was decoupled into an asynchronous event pipeline orchestrated by RabbitMQ:

3. Redis Cluster with Consistent Key Sharding

We rolled out a distributed session and inventory cache layer leveraging consistent hashing and Probabilistic Early Expiration (the XFetch algorithm), completely neutralizing cache stampede incidents.

[Client / Web + Mobile]
        │ (HTTPS / Traefik Reverse Proxy)
        ▼
[RoadRunner Go Workers Pool] ──(Session Cache)──► [Redis Cluster (6 Nodes)]
        │
        │ (Asynchronous Event: OrderPlaced)
        ▼
  [RabbitMQ Cluster]
   ├── [Worker: Inventory Reserve]
   ├── [Worker: Payment Dispatch]
   └── [Worker: PostgreSQL Transaction Pool (PgBouncer)]

Verifiable Production Results (Black Friday)

The overhauled architecture underwent real-world battle testing during Black Friday, handling the largest transactional traffic volume in the company's history:


Key Takeaways for CTOs & Executive Boards

  1. Vertical scaling has hard ceilings: Pumping more CPU cores and RAM into cloud instances without solving database locks merely masks technical debt.
  2. Asynchrony is the cornerstone of resilience: A distributed system should never process all side-effects synchronously within the initial HTTP request cycle.
  3. Telemetry-driven decisions: Every architectural refactoring initiative must be justified by hard metrics (p95, p99 latencies, row lock telemetry), never engineering intuition.
PS
Lead Architect & Implementation Author
Przemysław Sobolewski

Principal System Architect & Fractional CTO. Designs and audits high-throughput distributed systems for enterprises across the EU and US.

Consult Architecture