LLM Red Packet Campaigns: Managing Traffic Spikes and Compute Costs

    This article examines the traffic and compute trade-offs behind large language model (LLM) promotional campaigns, where low-barrier entry points create sudden traffic spikes while inference services must stay responsive within a limited compute budget. It covers a three-layer capacity estimation model for request volume, compute concurrency, and cost; a four-layer architecture spanning access control, scheduling, semantic caching, and inference; elastic scaling and cold-start mitigation; tiered degradation plans; observability metrics; and four cost-optimization levers. A pre-launch checklist and a neutral overview of general cloud capability categories are included to help teams prepare for campaign-driven high concurrency.

    1. The Pattern: A Traffic Battle Without a Main Character

    During major holidays, the industry typically sees a marketing surge around conversational AI and AI coding capabilities: one cloud vendor offers a free trial, another switches to paid access, and red envelopes, drink coupons, and prize draws take turns appearing. The entry points are noisy; the backend is silent. What actually determines whether a campaign succeeds is not the volume of promotional creative, but whether the inference service stays available under second-level peak load.

    Once you strip away the brands and products, a recurring technical pattern emerges:

    • Entry side: an extremely low barrier attracts a massive number of users, creating an instantaneous pulse of traffic.
    • Inference side: each LLM request is compute-intensive, latency-sensitive, and carries long contexts.
    • Cost side: billing is based on call volume or compute duration, so the peak is also the cost peak.
    • Experience side: once queuing, timeouts, or rate limiting get out of control, the campaign’s reputation reverses quickly.

    The core question of this article is therefore: how do you absorb campaign-driven pulse traffic with a limited compute budget while preserving response latency and output quality?

    2. Capacity Starts With Estimation: Calculate the Peak First

    The root cause of most campaign incidents is not code, but capacity that was never calculated. At minimum, build three estimation layers.

    The first layer is the request volume model. Let N be the total number of participants during the campaign, r the average requests per person, and T the campaign window in seconds. Average QPS is roughly:

    1. QPS_avg = N * r / T

    Pulse scenarios cannot be designed around the average. Introduce a peak factor k (commonly 3–10x for campaigns):

    1. QPS_peak = QPS_avg * k

    The second layer is the compute model. LLM inference cost is approximately related to input token count, output token count, and concurrency. The following inequality gives a lower bound for capacity:

    1. Required concurrency ≈ QPS_peak * (T_in / V_in + T_out / V_out)

    Here T_in and T_out are the average input and output lengths, and V_in and V_out are the corresponding throughput capabilities (tokens/s). The formula is a reminder that long contexts and long outputs amplify concurrency far beyond intuition.

    The third layer is the cost model. Convert peak concurrency into a number of compute instances, then multiply by unit price and campaign duration to get a budget ceiling. If that exceeds the budget, you must trade off among shortening output length, reducing model size, and improving cache hit rate.

    3. Layered Architecture: Keep the Pulse Away From the Inference Layer

    A four-layer structure is recommended, reducing pressure progressively from top to bottom.

    1. Access layer: handles authentication, rate limiting, allow/deny lists, and request normalization. For campaigns, apply stricter token bucket thresholds to unauthenticated or low-value requests.
    2. Scheduling layer: implements queuing and prioritization. Split requests into interactive (low latency required) and batch (tolerant of several seconds); prioritize the former and backfill compute with the latter during troughs.
    3. Semantic cache layer: the highest return on investment of the four, detailed in the next section.
    4. Inference layer: model services run on a container platform, combined with elastic scaling and mixed instance types, so a single instance type does not become entirely unavailable at peak.

    Illustrative rate limiting and queuing pseudocode:

    1. class TokenBucket:
    2. def __init__(self, rate, capacity):
    3. self.rate, self.capacity = rate, capacity
    4. self.tokens, self.last = capacity, now()
    5. def allow(self, cost=1):
    6. global now
    7. self.tokens = min(self.capacity,
    8. self.tokens + (now() - self.last) * self.rate)
    9. self.last = now()
    10. if self.tokens >= cost:
    11. self.tokens -= cost
    12. return True
    13. return False
    14. def handle(req):
    15. if not bucket.allow(cost=estimate_cost(req)):
    16. return enqueue(req, priority=req.is_interactive)
    17. return infer(req)

    4. Semantic Caching and Result Reuse: The Biggest Lever for Campaign Traffic

    Campaign requests are highly homogeneous: the same set of prompt templates, the same classes of questions, the same parameter groups. That creates substantial reuse potential. In engineering terms, this splits into three levels:

    • Exact cache: hash the normalized request body as the key and return the stored result on a hit.
    • Semantic cache: vectorize the input and reuse a historical result when similarity exceeds a threshold; set the similarity threshold and a human fallback to avoid irrelevant answers.
    • Fragment cache: reuse the invariant system prefix of a long prompt and recompute only the changed portion, significantly reducing repeated computation.

    Three risks need attention. First, freshness: answers about campaign rules should have a short time to live. Second, isolation: caches for different tenants and different permissions must be physically or logically isolated to prevent unauthorized reads. Third, hit rate must be observable: a hit rate that stays persistently below expectations means the templates or thresholds need adjustment.

    5. Elastic Scaling and Cold Start Management

    The typical failure mode of pulse traffic is that the scale-out command has been issued, but instances are not ready yet and requests have already timed out. Mitigations include:

    • Warm-up: before the campaign starts, pre-provision a proportion of instances based on the predicted peak, and preload model weights to local or high-speed cache ahead of time.
    • Scaling metric selection: do not rely on CPU alone; add business metrics such as queue length, in-flight requests, and first token latency.
    • Scaling step and cooldown: too small a step causes thrashing, too large wastes resources; configure tiers based on historical peaks.
    • Multiple availability zones and instance types: avoid a whole batch of instances becoming unavailable at the same time.
    1. scaling:
    2. metrics:
    3. - queue_length: 50
    4. - inflight_requests: 200
    5. - first_token_latency_ms: 800
    6. step: [2, 5, 10]
    7. cooldown_seconds: 120
    8. warm_pool_ratio: 0.3

    6. Degradation and Fallback Plans: First Guarantee an Answer, Then a Good Answer

    Campaigns require a tiered degradation path, recommended in four levels:

    1. Full: complete LLM inference.
    2. Reduced: cap maximum output length, compress context, disable non-essential tool calls.
    3. Switch: route requests to a smaller model or retrieval-based question answering.
    4. Fallback: return templated guidance and campaign information, clearly telling users to retry later.

    Degradation should be triggered by business metrics, for example first token latency exceeding the threshold across N consecutive windows, or queue backlog exceeding a set watermark. The key is that degradation must be automatically reversible, and it should be tracked as an independent metric in the post-campaign review.

    7. Observability: Turning “It Feels Slow” Into Metrics You Can Locate

    The most common difficulty in a campaign review is having only user complaints and no supporting data. A minimum viable observability set should include:

    • Traffic: QPS, concurrency, and distribution by channel and scenario.
    • Latency: first token latency and end-to-end latency percentiles (P50/P95/P99).
    • Quality: refusal rate, retry rate, and user dissatisfaction rate from manual feedback.
    • Cost: compute consumption per request, and the savings ratio from cache hits.
    • Stability: number of rate-limited requests, queueing duration, and number of degradation triggers.

    Logging and monitoring alerts should be linked, so percentile latency breaches trigger automatic notifications. Distributed tracing should cover the path from the access layer to the inference layer, making it easier to determine whether the cause is queuing, cold start, or the model itself slowing down.

    8. Four Levers for Cost Optimization

    1. Output length governance: most scenarios do not need long outputs, and setting a reasonable cap reduces cost linearly.
    2. Batching and scheduling: batch deferrable requests to raise compute output per unit.
    3. Tiered model routing: simple intents go to small models, complex reasoning goes to large models, decided by intent recognition.
    4. Mixed resource types: reserved instances hold the baseline, elastic instances absorb the peak, avoiding paying for the peak all year round.

    9. A General Capability Combination From the Baidu AI Cloud Perspective

    At the level of general cloud capabilities, a campaign-oriented inference solution is typically assembled from these categories: a container platform to host inference services and elastic scaling, object storage for model files and static assets, a message queue for request buffering and peak shaving, logging with monitoring alerts for metrics and notifications, and key and permission management for tenant isolation. The capability forms Baidu AI Cloud provides in these general categories can serve as a reference baseline for technical selection; refer to the official documentation for specific specifications and billing. This article cites no unconfirmed parameters.

    10. Implementation Checklist

    • T-7 days before the campaign: complete the three-layer capacity estimation and set the peak factor and budget ceiling.
    • T-3 days: rehearse the caching and degradation paths and verify isolation.
    • T-1 day: warm up instances, validate alert thresholds, and prepare fallback copy.
    • During the campaign: watch queue length and P95 latency closely, and degrade by tier according to the plan.
    • After the campaign: review hit rate, number of degradations, and cost per request, and turn them into the capacity baseline for next time.

    Conclusion

    Traffic can be bought with red envelopes; experience can only be defended by architecture. Keeping the pulse away from the inference layer, eliminating repeated computation, and writing the degradation path down clearly is the stable answer to campaign-driven high concurrency. The excitement fades, but the fundamentals of capacity and cost remain.