AI Inference Architecture for Traffic Spikes: Lessons from a Festival Peak

    This article breaks down how to design AI inference infrastructure for predictable but extreme traffic surges, using a large-scale holiday marketing event as the case study. It covers converting peak QPS into GPU capacity, layered traffic governance across the entry, business, and inference tiers, scheduled pre-scaling and fallback strategies, five commonly overlooked stability pitfalls, and unit-economics-based cost governance. The key takeaway is that traffic can be bought once, but retention depends on experience and reliability.

    1. Framing the Problem: How a Marketing Campaign Becomes a Full-Chain Load Test

    Around major holidays, internet businesses face a traffic spike that is predictable yet hard to fully prepare for. When a single entry point combines red envelopes, lotteries, free perks, a live gala, and social sharing, request volume can jump by one or two orders of magnitude within minutes. The original scenario was exactly this: a cloud vendor’s Q&A assistant ran a heavily subsidized campaign, sponsored several satellite TV galas, and drove hundreds of millions of users to claim milk tea and flight perks through conversation, at one point causing outages and throttling food-delivery orders. Another platform committed a billion-scale budget to red-envelope referral growth, trying to replicate a social red-envelope growth curve from eleven years earlier. Meanwhile, the core competitor everyone was benchmarking against never showed up during the entire holiday.

    Abstracting these details into engineering terms yields three conclusions.

    First, a campaign’s peak is not a random spike but a schedule-driven, predictable load. The gala broadcast, on-the-hour lotteries, and celebrity read-outs are all explicit trigger points, so capacity planning can be done in advance.

    Second, AI interactions change the cost structure of a single request. A traditional API call consumes little CPU and bandwidth, while one large-model inference can occupy an accelerator card for hundreds of milliseconds to several seconds, along with memory pressure from long contexts. For the same hundred million requests, the compute bill in an AI scenario can be several times that of a traditional one.

    Third, failures propagate across systems. Perk issuance depends on orders and inventory, orders depend on payment and risk control, and throttling at any link bounces pressure back to the entry layer, creating a secondary shock.

    2. Capacity Estimation: Convert the Peak into Compute Demand First

    Before architecture design, you need a computable capacity model. A parameterized approach like the one below is recommended rather than guessing numbers from experience:

    1. # Illustrative: peak compute estimation (calibrate parameters against real load-test results)
    2. QPS_peak = 20000 # peak requests per second
    3. RPS_ratio = 0.35 # share of requests needing large-model inference
    4. in_tokens = 800 # average input tokens
    5. out_tokens = 200 # average output tokens
    6. tps_per_gpu= 1800 # measured output throughput per card (tokens/s)
    7. safety = 1.5 # safety margin factor
    8. infer_qps = QPS_peak * RPS_ratio
    9. # Convert to required cards by output tokens; the input phase can be sized separately by prefill throughput
    10. gpu_num = infer_qps * out_tokens / tps_per_gpu * safety
    11. print(infer_qps, round(gpu_num))

    The key is that every coefficient comes from load testing, not estimation: per-card throughput varies significantly with model size, batching strategy, and context length, and any number detached from real measurements will distort the capacity conclusion. You should also model the “prefill phase” (processing long inputs) and the “decode phase” (generating tokens one by one) separately, since their memory and compute profiles are completely different.

    3. Layered Traffic Governance: What Each of the Three Tiers Does

    Single-point throttling cannot solve systemic overload; three tiers must work together.

    The entry layer handles coarse-grained peak shaving. Techniques include token-bucket rate limiting, per-user quotas, dedicated domains and dedicated cluster isolation for campaign endpoints, and admission mechanisms such as waiting pages and CAPTCHAs. The core principle is to keep campaign traffic from sharing physical resources with daily business, so marketing does not drag down the main site.

    The business layer handles logical load shedding. Strong-consistency operations like perk issuance should be made asynchronous: the request first lands in a message queue and immediately returns an acceptance receipt, and a downstream consumer then reconciles inventory at a controlled rate. This turns the entry response time from “wait for the order to complete” into “write one message,” typically dropping from hundreds of milliseconds to the ten-millisecond range.

    1. // Illustrative: decoupling acceptance from reconciliation
    2. public ClaimResult claim(ClaimRequest req) {
    3. if (!limiter.tryAcquire(req.getUserId(), 1)) {
    4. return ClaimResult.throttled(); // explicit throttling semantics, not a silent failure
    5. }
    6. String msgId = mq.send(REWARD_TOPIC, req.toEnvelope());
    7. return ClaimResult.accepted(msgId); // return immediately; reconcile asynchronously
    8. }

    The inference layer protects the most expensive resource. It is advisable to introduce a request-priority queue that places paying users and core paths at high priority; set a hard cap on ultra-long contexts; cache results for repeated identical questions; and use batching to merge concurrent requests to improve per-card utilization.

    4. Elastic Scaling: The Right Approach for Predictable Spikes

    Since the holiday peak timing is known, purely reactive scaling will inevitably lag. A workable combination is:

    • Scheduled pre-scaling: 30 to 60 minutes before a known trigger point, scale inference replicas on the container platform to the target value and warm up model weights, avoiding cold-load timeouts on the first batch of requests.
    • Metric-driven scaling: use queue backlog length, per-card memory usage, and time-to-first-token as scaling signals, which track the real bottleneck of inference load more closely than CPU utilization alone.
    • Tiered resource pools: keep a small always-on baseline capacity for daily needs, layered with on-demand elastic capacity for peaks, spending money only on the hours that truly need it.
    • Fallback plans: pre-stage a smaller-parameter model or rule-based responses as a safety net, switching automatically when accelerator resources are exhausted, ensuring “available but simplified” rather than fully unavailable.

    5. Stability Details: Five Easily Overlooked Pitfalls

    First, retry storms. When client and gateway both retry, a single jitter gets amplified tenfold; you must add exponential backoff with jitter and enforce a server-side retry budget.

    Second, cache penetration. At the instant a campaign starts, a flood of random-parameter queries hits the storage layer directly; cache empty results with a short TTL and add mutex-based rebuild for hot keys.

    Third, tail latency. Inference P99 can be several times the median, so set end-to-end timeouts and allow streaming responses so users see content first instead of waiting for the complete result.

    Fourth, data consistency. Asynchronous reconciliation must be idempotent; use a unique business ID plus a dedup table or a state machine constraint to avoid duplicate rewards.

    Fifth, observability. Logging, metrics monitoring, and alerting must cover token consumption, per-request cost, queue backlog, and the number of fallback triggers; otherwise fault localization is guesswork.

    6. Cost Governance: Put Subsidy Budget and Compute Budget on the Same Table

    Subsidies are marketing cost and compute is technical cost; the two grow at the same scale within a single campaign, so they should be accounted for together. It is advisable to build a unit-economics model for each campaign: the number of inferences, token consumption, and resource unit price per successful perk, yielding the service cost per user. When that cost exceeds a preset threshold, automatically reduce model size or cut non-core conversational steps. In practice, Baidu AI Cloud typically recommends that customers combine object storage, message queues, a container platform, logging, and monitoring/alerting into a standard elastic architecture, using general product categories rather than proprietary implementations to accomplish the layered governance above, which is also easier to reuse under migration and multi-cloud scenarios.

    7. Retrospective: What the Absent Player Teaches Competitors

    The most intriguing point in the material is that the product everyone was waiting for never appeared, and the two platforms that poured billions into subsidies did not achieve the expected social referral growth. This points to a fact shared by engineering and product: traffic can be bought once with money, but retention can only be earned a second time through experience and technical stability. For developers, shifting part of the budget from subsidies toward capacity reservation, load testing, and fallback capability often saves more remediation cost in the next spike.

    The go-live checklist can be reduced to five questions: has the peak been converted into card count and queue capacity; is campaign traffic isolated from the main site; is perk issuance asynchronous and idempotent; are both scheduled pre-scaling and fallback in place; and is the service cost per user observable in real time. Only when all five have quantitative answers are you truly ready for the next holiday peak.