I. What Is Production Environment Operations for AI Services
Production environment operations for AI services refers to the ongoing management of application services, model inference, data processing, infrastructure, and external dependencies after an AI application is officially launched.
Traditional web service operations mainly focus on:
- Whether services are available.
- Whether APIs are functioning normally.
- Whether request responses are fast enough.
- Whether CPU, memory, and network are normal.
- Whether the database is stable.
- Whether services can recover after a failure.
In addition to these basic issues, AI services also need to focus on the runtime characteristics of the models themselves.
For example:
- Model response times may be much higher than those of ordinary APIs.
- The number of input and output tokens directly affects invocation costs.
- GPU memory may become the main bottleneck for inference services.
- Model output quality may vary with input distribution and external model services.
- RAG systems may experience outdated knowledge bases and degraded retrieval quality.
- Agents may consume substantial resources due to tool call failures or looping execution.
- Streaming responses may experience excessive time to first token or mid-stream interruptions.
- Model providers may experience rate limiting, timeouts, and service unavailability.
Therefore, production operations for AI services need to manage four dimensions simultaneously:
| Operations dimension | Core objective | Main focus |
|---|---|---|
| Service reliability | Ensure continuous service availability | Availability, error rate, failure recovery |
| Inference performance | Ensure requests are completed promptly | Latency, throughput, concurrency, GPU |
| AI quality | Ensure output meets expectations | Accuracy, relevance, faithfulness |
| Operating cost | Control resource and invocation costs | Token, GPU, model invocation costs |
AI service operations is not simply deploying a model to a server; rather, it is about ensuring that the entire AI system continues to work stably under real business loads.
II. Overall Architecture of the AI Service Production Environment
A complete AI production environment usually includes an access layer, application layer, AI inference layer, data layer, infrastructure layer, and observability platform.
1. Overall Architecture
| Architecture layer | Core components | Main responsibilities |
|---|---|---|
| Access layer | API Gateway, load balancing, WAF | Traffic ingress, authentication, rate limiting |
| Application layer | AI API, business services, Agent | Process business requests and task orchestration |
| Model inference layer | Model Gateway, Inference Server | Model routing, inference, and scheduling |
| Data layer | Vector DB, database, object storage | Manage knowledge base and business data |
| Infrastructure layer | Kubernetes, GPU, CPU, network | Provide runtime resources |
| Observability layer | Metrics, Logs, Traces, Alerting | Monitoring, analysis, and fault localization |
2. Production Environment Request Processing Flow
flowchart TD
A["User initiates request"] --> B["API Gateway"]
B --> C["Authentication and authorization verification"]
C --> D["Rate limiting and request validation"]
D --> E["AI application service"]
E --> F["Prompt and context construction"]
F --> G["Model Gateway"]
G --> H["Model routing and scheduling"]
H --> I["Model inference service"]
I --> J["Output parsing and safety checks"]
J --> K["Return user response"]
I --> L["Metrics, logs, and tracing"]
E --> L
G --> L
L --> M["Monitoring and alerting platform"]
style A fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style B fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style C fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style D fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style E fill:#EAF3EC,stroke:#83A995,color:#315D49
style F fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style G fill:#EAE8FA,stroke:#A49BD5,color:#51477D
style H fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style I fill:#EAF3EC,stroke:#83A995,color:#315D49
style J fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style K fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style L fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style M fill:#EAE8FA,stroke:#A49BD5,color:#51477D
3. Core Operational Objects in the Production Environment
Production environments cannot monitor only the model service; you also need operational capabilities across the entire dependency chain.
The main objects include:
Application Services
- API services.
- Agent execution services.
- RAG retrieval services.
- Asynchronous task services.
- Workflow scheduling services.
Model Services
- Third-party model APIs.
- Self-hosted model inference services.
- Embedding services.
- Reranker services.
- Multimodal model services.
Data Services
- Relational databases.
- Vector databases.
- Cache systems.
- Message queues.
- Object storage.
Infrastructure
- CPU and GPU.
- GPU memory.
- Memory.
- Network bandwidth.
- Storage space.
- Containers and Kubernetes clusters.
These components have dependencies on one another, and a failure in any critical component can affect the entire AI application.
III. The Observability System for AI Services
Observability is the foundation of production operations.
It is used not only to detect service failures, but also to analyze model performance, invocation cost, and output quality.
Traditional observability mainly consists of three parts: Metrics, Logs, and Traces.
AI services also need to add model quality evaluation and cost analysis.
1. Metrics: Metric Monitoring
Metrics are numeric measurements recorded as time series.
Common monitoring metrics include:
| Metric Category | Specific Metrics | Monitoring Purpose |
|---|---|---|
| Service metrics | QPS, error rate, availability | Determine service health status |
| Latency metrics | P50, P95, P99 | Observe request response time |
| Model metrics | Token count, model latency | Analyze inference performance |
| GPU metrics | GPU utilization, GPU memory usage | Identify inference resource bottlenecks |
| Queue metrics | Queue length, wait time | Detect request backlog |
| Cost metrics | Cost per request, daily expense | Control invocation costs |
| Quality metrics | Accuracy, task completion rate | Determine AI output effectiveness |
It is recommended to prioritize P95 and P99 latency rather than focusing only on average response time.
For example, the average response time may be only 1 second, but P99 reaches 15 seconds, meaning some users still have to wait a long time.
2. Logs: Log Management
Logs are used to record detailed information about the request execution process.
For AI services, it is recommended to log:
- Request ID.
- Trace ID.
- User or tenant identifier (using an appropriately masked identifier).
- Model name and version.
- Prompt version.
- Number of input tokens.
- Number of output tokens.
- Model response time.
- Tool call results.
- Error type.
- Request completion status.
Log example:
{
"timestamp": "2026-11-26T10:30:00Z",
"request_id": "req-10001",
"trace_id": "trace-20001",
"service": "ai-assistant",
"model": "example-model",
"prompt_version": "v3",
"input_tokens": 1200,
"output_tokens": 350,
"latency_ms": 1850,
"status": "success"
}
Production logs need to consider:
- Do not unconditionally store users' full input and model output.
- Mask sensitive information.
- Control the log retention period.
- Avoid writing API keys or access tokens into logs.
- Set permissions for log access.
- Sample or aggregate high-frequency logs.
3. Traces: Distributed Tracing
A Trace is used to track the complete call chain that a request passes through.
For a RAG system, a single request may include:
User Request
├── API Gateway
├── Authentication
├── Query Rewriting
├── Embedding
├── Vector Retrieval
├── Reranker
├── Prompt Construction
├── LLM Call
└── Output Parsing
In actual engineering practice, the call chain above should establish parent-child relationships through Trace Spans.
For example:
{
"trace_id": "trace-20001",
"spans": [
{
"name": "api_request",
"duration_ms": 2100
},
{
"name": "embedding",
"duration_ms": 120
},
{
"name": "vector_search",
"duration_ms": 85
},
{
"name": "llm_generation",
"duration_ms": 1650
},
{
"name": "output_validation",
"duration_ms": 45
}
]
}
Distributed tracing can reveal:
- Whether retrieval latency is too high.
- Whether model generation latency is too high.
- Whether unnecessary model calls occurred.
- Whether tool calls were duplicated.
- Whether any external API timed out.
4. AI-Specific Observability
AI services should also monitor model behavior.
For example:
| Metric | Description |
|---|---|
| Input Tokens | Number of input tokens per request |
| Output Tokens | Number of output tokens per request |
| First Token Latency | Latency of the first token |
| Generation Throughput | Generation token throughput |
| Model Error Rate | Model call failure rate |
| Tool Call Count | Number of tool calls |
| Task Completion Rate | Task completion rate |
| Groundedness | Whether the answer is grounded in context |
| Refusal Rate | Model refusal rate |
| Cost Per Request | Cost per request |
AI quality metrics cannot necessarily be calculated in real time.
For example, answer faithfulness may require an evaluation model or manual sampling evaluation. Therefore, production environments can combine real-time runtime metrics with asynchronous quality evaluation.
5. Overall Observability Architecture
flowchart TD
A["AI 服务运行"] --> B["Metrics 指标"]
A --> C["Logs 日志"]
A --> D["Traces 链路"]
A --> E["AI 质量数据"]
A --> F["成本数据"]
B --> G["可观测性平台"]
C --> G
D --> G
E --> H["质量评估平台"]
F --> I["成本分析平台"]
G --> J["监控仪表盘"]
H --> J
I --> J
J --> K["异常检测与告警"]
style A fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style B fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style C fill:#EAF3EC,stroke:#83A995,color:#315D49
style D fill:#EAE8FA,stroke:#A49BD5,color:#51477D
style E fill:#EAF3EC,stroke:#83A995,color:#315D49
style F fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style G fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style H fill:#EAE8FA,stroke:#A49BD5,color:#51477D
style I fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style J fill:#EAF3EC,stroke:#83A995,color:#315D49
style K fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
6. Common Observability Tools
| Tool | Primary Use |
|---|---|
| Prometheus | Metrics collection and storage |
| Grafana | Monitoring dashboards |
| OpenTelemetry | Standardized collection of metrics, logs, and traces |
| Jaeger | Distributed tracing |
| Loki | Log aggregation and querying |
| Elasticsearch | Log search and analysis |
| Alertmanager | Alert routing and notification |
| NVIDIA DCGM Exporter | GPU metrics collection |
Actual tool selection should be determined by the deployment environment, data scale, and the team's operations capabilities; it is not necessary to deploy all tools from the start.
IV. Core Monitoring Metrics for AI Services
Monitoring metrics need to be tied to business objectives.
You cannot judge that the system is running well merely because GPU utilization is high, nor can you assume there are no problems with model output quality just because the API returns no errors.
1. Service Availability
Availability is the proportion of a specified time period during which the system can provide service normally.
Common calculation method:
For example:
- Total requests: 100000.
- Successful requests: 99900.
Then:
However, production environments need to clearly define what constitutes a successful request.
For example, an HTTP 200 response does not mean an AI task has necessarily succeeded. If an Agent does not complete the task, or the model output violates business constraints, it cannot simply be counted as a success.
Therefore, it is recommended to track the following separately:
- API availability rate.
- Model invocation success rate.
- Business task success rate.
- AI quality pass rate.
2. Request Latency
Common latency metrics:
- P50: The response time of 50% of requests is below this value.
- P90: The response time of 90% of requests is below this value.
- P95: The response time of 95% of requests is below this value.
- P99: The response time of 99% of requests is below this value.
For streaming model services, the following also require attention:
TTFT (Time To First Token)
The time from when a request is sent to when the first output token is received.
TPOT (Time Per Output Token)
The average time required per output token during generation.
TPS (Tokens Per Second)
The number of tokens the model generates per second.
These metrics can help distinguish performance issues in model startup, request queuing, and the actual generation stage.
3. Throughput
Throughput indicates the system's ability to process requests or generate tokens per unit of time.
Common metrics:
For large-model inference services, using only QPS to measure performance may not be sufficient.
This is because input and output lengths vary greatly across different requests.
For example:
- Request A has 100 input tokens and 50 output tokens.
- Request B has 8000 input tokens and 2000 output tokens.
Although both count as only one request, their resource consumption differs greatly.
Therefore, both request throughput and token throughput need to be monitored.
4. GPU Resource Metrics
Self-hosted models require particular attention to GPU.
| Metric | Meaning |
|---|---|
| GPU Utilization | GPU compute utilization |
| GPU Memory Used | GPU memory usage |
| GPU Memory Utilization | GPU memory utilization ratio |
| SM Utilization | GPU compute unit utilization |
| Power Usage | GPU power consumption |
| Temperature | GPU temperature |
| PCIe Throughput | PCIe data transfer status |
| GPU Error | GPU hardware or driver errors |
Note that high GPU utilization does not necessarily mean the system is efficient.
If GPU memory is insufficient, the request queue is too long, or model scheduling is unreasonable, users may still experience severe latency even when GPU utilization is high.
5. Model Quality Metrics
Model quality metrics should be designed according to the business type.
For example:
RAG Systems
- Retrieval recall.
- Retrieval precision.
- Context relevance.
- Answer faithfulness.
- Answer relevance.
Agent Systems
- Task completion rate.
- Tool selection accuracy.
- Tool invocation success rate.
- Average number of execution steps.
- Task execution cost.
Structured Output Systems
- JSON validity rate.
- Schema pass rate.
- Field completeness rate.
- Field accuracy rate.
6. Monitoring Metrics and Alert Thresholds
Below is a set of example thresholds. In practice, they need to be adjusted based on service SLOs, business peaks, and historical baselines.
| Metric | Example alert condition | Handling direction |
|---|---|---|
| API error rate | Continuously above 2% | Check the service and its dependencies |
| P95 latency | Continuously above 5 seconds | Analyze the call chain |
| Model failure rate | Continuously above 3% | Check the provider and model service |
| GPU memory | Continuously above 90% | Check the model and batching |
| Request queue | Continues to grow | Scale out or apply rate limiting |
| Cost per request | Exceeds the budget threshold | Check token usage and call counts |
| Task completion rate | Below the business baseline | Check the model and workflow |
Alerts should not be triggered based on a single instantaneous data point.
It is recommended to combine duration, request volume, error ratio, and scope of business impact to reduce false positives.
V. Performance Operations for AI Inference Services
Inference performance directly affects user experience and infrastructure costs.
Performance issues in large model inference usually come from model computation, GPU memory management, request scheduling, and network communication.
1. Main Performance Stages of Inference Services
A single model inference typically includes:
- Request reception.
- Request queuing.
- Input preprocessing.
- Prefill.
- Decode.
- Output transmission.
Among them:
Prefill stage
The model processes input tokens in parallel and builds the KV Cache required for subsequent generation.
Decode stage
The model generates output tokens step by step and continuously uses the KV Cache.
These two stages have different computational characteristics, so production environments need to monitor them separately.
For example:
- Prefill may be affected by input length and computational throughput.
- Decode may be affected by memory bandwidth, concurrent requests, and output length.
2. Inference Performance Optimization Techniques
| Optimization technique | Effect | Primary goal |
|---|---|---|
| Continuous Batching | Dynamically organize request batches | Increase throughput |
| PagedAttention | Optimize KV Cache management | Reduce wasted GPU memory |
| Quantization | Lower model weight precision | Reduce memory footprint |
| Prefix Caching | Reuse computation for shared prefixes | Reduce repeated Prefill |
| Speculative Decoding | Use an auxiliary model to predict tokens | Reduce generation latency |
| Tensor Parallelism | Multi-GPU collaborative computation | Support larger models |
| Pipeline Parallelism | Distribute model layers across stages | Improve model deployment capability |
These optimizations are not a case of the more the better.
For example, quantization may affect model quality, tensor parallelism may increase GPU communication overhead, and batching may also increase the waiting time of some requests.
You need to find the appropriate configuration through actual load testing.
3. Request Queue Management
When requests arrive faster than the model can process them, queuing occurs in the system.
Without queue management, this can lead to:
- Request wait times continuing to grow.
- Service memory continuously increasing.
- Request timeouts.
- GPUs remaining under high load for extended periods.
- Users resubmitting requests, further aggravating congestion.
It is recommended to set:
- Maximum queue length.
- Request timeout.
- Maximum concurrency.
- Request quota per tenant.
- Priority queues.
- Overload protection policies.
4. Overload Handling Process for Inference Services
flowchart TD
A["Receive model request"] --> B["Check current load"]
B --> C{"Has capacity limit been reached?"}
C -->|No| D["Enter inference queue"]
C -->|Yes| E{"Is queueing allowed?"}
E -->|Yes| F["Check queue capacity"]
E -->|No| G["Return rate-limit response"]
F --> H{"Is the queue full?"}
H -->|No| D
H -->|Yes| I["Reject new requests or degrade"]
D --> J["Schedule model inference"]
J --> K["Return model result"]
G --> L["Record rate-limiting metrics"]
I --> L
style A fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style B fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style C fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style D fill:#EAF3EC,stroke:#83A995,color:#315D49
style E fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style F fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style G fill:#F7EAE7,stroke:#C98D7C,color:#754438
style H fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style I fill:#F7EAE7,stroke:#C98D7C,color:#754438
style J fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style K fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style L fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
5. Model Timeouts and Retries
Model calls may encounter:
- Connection timeout.
- Read timeout.
- HTTP 429 rate limiting.
- HTTP 5xx service errors.
- Upstream connection interruption.
- Incomplete model output.
Production environments need to distinguish retryable errors from non-retryable errors.
| Error Type | Recommended Handling |
|---|---|
| Connection timeout | Retry a limited number of times |
| Read timeout | Decide whether to retry based on request type |
| HTTP 429 | Follow rate-limiting policy and back off |
| HTTP 500 / 503 | Retry a limited number of times or switch providers |
| Parameter error | Return directly and fix parameters |
| Permission error | Check keys and authorization |
| Output format error | Perform limited repairs or degrade |
When retrying, use exponential backoff with random jitter to avoid a large number of requests retrying at the same time.
Also note that generation requests are not always idempotent.
For operations with side effects, such as Agent tool calls, payments, and sending emails, do not directly repeat execution just because a model request timed out. Use idempotency keys, execution status checks, and compensation mechanisms.
VI. Elastic Scaling of AI Services
Elastic scaling is the process of automatically adjusting service resources based on business load.
The resource consumption of AI services differs from that of traditional web services.
Traditional APIs may be mainly affected by CPU and memory, whereas AI inference services are also affected by GPU memory, token throughput, and request length.
1. Horizontal and Vertical Scaling
Horizontal Scaling
Increase or decrease the number of service instances.
For example:
- Scale from 2 inference instances to 5.
- Scale down from 10 API instances to 4.
Advantages:
- Easy to distribute request load.
- Can improve overall availability.
- Supports gradual scaling.
Disadvantages:
- May require additional GPUs.
- Multiple instances need to coordinate models and caches.
- Loading large model weights incurs additional overhead.
Vertical Scaling
Increase the resource configuration of a single instance.
For example:
- Increase the number of CPU cores.
- Increase memory.
- Use GPUs with more memory.
- Use higher-performance GPUs.
Advantages:
- Does not necessarily require adding instances.
- Directly addresses insufficient memory on a single instance.
Disadvantages:
- There is an upper limit on hardware specifications.
- May require restarting the service.
- A single-instance failure has a larger impact.
2. Scaling Criteria for AI Services
It is not recommended to scale based only on CPU utilization.
More reasonable metrics include:
- GPU utilization.
- GPU memory usage.
- Request queue length.
- Wait time.
- Number of active requests.
- Input token throughput.
- Output token throughput.
- Model inference latency.
- Service instance health status.
For example:
| Load Status | Recommended Action |
|---|---|
| GPU utilization remains high | Evaluate scaling out or optimize inference |
| GPU memory approaching limit | Limit concurrency or add GPU memory resources |
| Queue continues to grow | Scale out, rate-limit, or optimize batching |
| Request volume decreases | Scale in appropriately |
| Latency increases but GPU utilization is low | Check network, scheduling, and external dependencies |
3. Elastic Scaling Workflow
flowchart TD
A["Collect system load"] --> B["Analyze GPU, queue, and latency"]
B --> C{"Exceeds scale-out threshold?"}
C -->|Yes| D["Add inference instances"]
C -->|No| E{"Below scale-in threshold?"}
E -->|Yes| F["Check minimum instance count"]
F --> G["Reduce idle instances"]
E -->|No| H["Maintain current capacity"]
D --> I["Load model and perform health check"]
G --> J["Confirm remaining instance capacity"]
I --> K["Re-evaluate load"]
J --> K
H --> K
style A fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style B fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style C fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style D fill:#E0F0FE,stroke:#93BCE8,color:#1E4976
style E fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
style F fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style G fill:#EAE8FA,stroke:#A49BD5,color:#51477D
style H fill:#EAF3EC,stroke:#83A995,color:#315D49
style I fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style J fill:#F5F8F4,stroke:#B5CBBB,color:#40594A
style K fill:#DCEFE5,stroke:#4F8B70,color:#24563F
4. Kubernetes HPA and GPU Scaling
Kubernetes HPA (Horizontal Pod Autoscaler) can automatically adjust the number of Pods based on metrics.
For ordinary CPU scaling, you can use:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ai-api-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: ai-api
minReplicas: 2
maxReplicas: 10
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
However, for GPU inference services, using only CPU metrics is not enough.
You can use mechanisms such as Prometheus Adapter or KEDA to integrate custom metrics such as GPU utilization and queue length into the autoscaling system.
Pay particular attention to the following:
- GPU node resources are usually relatively scarce.
- Model loading takes time.
- Starting a new instance may require downloading model weights.
- Scaling in may interrupt requests that are being processed.
- GPU resources require consideration of device plugins and scheduling constraints.
Therefore, AI inference services usually need to combine pre-warmed instances, minimum replica counts, and graceful shutdown mechanisms.
VII. High Availability and Disaster Recovery for AI Services
High Availability (HA) means that a system can continue to provide services when some components fail.
AI services need to establish high availability mechanisms at multiple layers: application, model, data, and infrastructure.
1. Application-Layer High Availability
Common measures:
- Multi-replica deployment.
- Load balancing.
- Health checks.
- Automatic restart.
- Isolation of failed instances.
- Rolling updates.
- Graceful shutdown.
Application services should not depend on a single instance.
If an instance fails, the load balancer should forward requests to healthy instances.
2. Model-Layer High Availability
If you use third-party model APIs, you need to consider vendor failures.
You can design routing across multiple model providers:
- Use the primary model when it is healthy.
- Switch to a backup model when the primary model experiences persistent failures.
- Enable a degradation strategy when the backup model's capabilities are insufficient.
- Gradually switch back according to policy after the primary model recovers.
However, different models may differ in output quality, parameter support, context length, and pricing.
Before switching models, you need to confirm that the backup model meets business requirements; you should not switch directly just because an API is available.
3. Circuit Breaker Mechanism
A circuit breaker is used to prevent a failing service from continuously receiving a large number of requests.
It usually includes three states:
Closed: Closed State
Requests pass through normally, and the system continuously tracks failures.
Open: Open state
Once failures reach the threshold, requests are temporarily rejected to avoid continuing to hammer a failing service.
Half-Open: Half-open state
After waiting a period of time, a small number of probe requests are allowed through to determine whether the service has recovered.
stateDiagram-v2
[*] --> Closed
Closed --> Open: failures reach threshold
Open --> HalfOpen: circuit-breaker wait time elapsed
HalfOpen --> Closed: probe request succeeds
HalfOpen --> Open: probe request fails
style Closed fill:#DCEFE5,stroke:#4F8B70,color:#24563F
style Open fill:#F7EAE7,stroke:#C98D7C,color:#754438
style HalfOpen fill:#F7F4E8,stroke:#C7B77A,color:#675A2D
Circuit breakers are particularly well suited to protecting:
- Third-party model APIs.
- Embedding services.
- Vector databases.
- External tool APIs.
- Business databases.
4. Model degradation strategies
When the primary model is unavailable, different degradation approaches can be adopted according to business requirements.
| Degradation method | Description | Applicable scenario |
|---|---|---|
| Backup model | Switch to another model | Model provider failure |
| Smaller model | Use a lower-cost model | Non-core tasks |
| Cached results | Return previously computed results | Reusable queries |
| Rule engine | Handle with deterministic logic | Simple classification and validation |
| Static response | Return a preset message | Temporary failures |
| Feature shutdown | Disable some AI features | High-risk failures |
Note that cached results must take user permissions, data freshness, and contextual differences into account; one user's personalized result must not be returned directly to another user.
5. Disaster tolerance capabilities
Disaster recovery (DR) is used to cope with infrastructure or data failures on a larger scale.
Common approaches:
- Multi-availability-zone deployment.
- Off-site backups.
- Database primary-replica replication.
- Object storage backups.
- Vector index snapshots.
- Cross-region service deployment.
- Disaster recovery drills.
6. RTO and RPO
Two metrics need to be clearly defined in disaster recovery design.