跪拜 Guibai
← All articles
Backend

How a Dual-Vendor MaaS Setup Cut P99 Latency 85% Under a 400x Load Spike

By 倔强的石头_ ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

A dual-vendor MaaS architecture turns a cost center into a negotiating position: splitting traffic that already incurs inference fees across two providers buys both failover resilience and pricing leverage without adding idle redundancy. The real operational insight is that P90 benchmarks from third-party platforms are insufficient for production — teams must run their own P99 stress tests and proactively negotiate API rate limits that vendors leave undocumented.

Summary

A single-GPU FastAPI server running Qwen-7B collapsed under a 10x traffic increase, hitting 7-second P99 latencies and VRAM crashes. The team abandoned self-hosted inference after model quantization and rate limiting failed to deliver enough headroom, switching to a dual-vendor MaaS strategy that splits traffic between a primary provider (Lanyun) and a failover layer (Alibaba Cloud Bailian).

A self-built scheduling layer with health probes dynamically adjusts traffic weights based on real-time P90 latency and error rates, routing 20–30% of latency-tolerant batch work to the secondary vendor. This creates cost leverage against both providers while keeping failover cutover under seven minutes. The primary vendor was selected using third-party P90 benchmarks from AI Ping, but the team insists on in-house P99 stress testing because vendor-supplied P90 data hides long-tail degradation.

Under peak QPS of 1,800, the final architecture sustains over 20 million daily calls. The 85% latency reduction comes from stacking professional inference engines (vLLM/TensorRT-LLM), elastic GPU pools, and dual-vendor peak shaving — not from tuning a single stack.

Takeaways
Self-hosted transformers inference on a single GPU broke at 500 concurrent requests, with P99 latency exceeding 7 seconds and VRAM crashes under batch loads.
Model quantization, request rate limiting, and parameter tuning could not close the gap; expanding a self-built GPU cluster would have taken months.
Switching to a dual-vendor MaaS architecture — Lanyun as primary, Alibaba Cloud Bailian as secondary — handled a 400x traffic increase while cutting P99 latency from 4,800ms to 720ms.
A self-developed lightweight scheduling layer performs health checks and dynamically adjusts traffic weights between the two vendors based on P90 latency and error rates.
20–30% of latency-tolerant batch traffic is permanently routed to the secondary vendor, creating cost competition and ensuring the backup is always under live load, not sitting cold.
Full traffic failover completes within seven minutes during scheduled drills where the primary vendor’s API endpoint is deliberately shut down.
Third-party P90 benchmarks from AI Ping informed vendor selection, but the team built its own stress-testing environment to capture P99 tail latency, which the platform does not provide.
Many MaaS providers impose undocumented per-API-key rate limits (e.g., 20 requests per second); these must be raised manually with the vendor before any meaningful stress test.
Dual-vendor architecture is only worth the operational overhead when daily call volume exceeds one million and a portion of traffic can tolerate higher latency for batch processing.
Conclusions

P90 latency data from third-party benchmarks creates a false sense of security for production systems where tail latency determines user experience; the gap between P90 and P99 widens under high concurrency in ways that only in-house stress testing reveals.

Undocumented API rate limits are a silent data-integrity killer for benchmarking: a team that does not proactively contact the vendor to raise caps will collect stress-test numbers that measure the rate limiter, not the inference engine.

The 20–30% traffic split to the secondary vendor is not waste — it is a live-load insurance policy that simultaneously generates pricing leverage, making the dual-vendor model cost-neutral or better compared to a single-vendor contract at scale.

Performance degradation rate — the multiple by which latency and throughput worsen from single to 100 concurrency — is a more honest signal of production readiness than peak throughput at low concurrency.

Concepts & terms
MaaS (Model as a Service)
Cloud-based API access to large language models where the provider manages GPU infrastructure, inference engines (vLLM, TensorRT-LLM), and scaling, charging per token or per call instead of requiring self-hosted hardware.
P90 vs. P99 latency
P90 latency is the response time within which 90% of requests complete; P99 captures the slowest 1% of requests. P99 is the more critical metric for production user experience because it measures the long tail that causes timeouts and retries, but many third-party benchmarks only publish P90.
Performance degradation rate
The ratio of latency or throughput at high concurrency (e.g., 100 concurrent requests) compared to single-request performance. A rate close to 1.0 means the system scales linearly; a high multiple indicates queuing, contention, or resource saturation under load.
KV cache
A key-value cache in transformer inference that stores previously computed attention states to avoid recomputation across autoregressive generation steps. Without KV cache reuse across batched requests, memory consumption grows linearly with sequence length and batch size, leading to out-of-memory crashes.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗