# WiredTiger 错误 (0) - 缓存卡住：驱逐工作线程停滞了 120 秒

- **ID:** `mongodb/wiredtiger-cache-eviction-stall`
- **领域:** mongodb
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

WiredTiger 缓存已满且驱逐无法跟上，通常由于高写入负载或缓存大小不足。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| mongodb-4.2 | active | — | — |
| mongodb-4.4 | active | — | — |
| mongodb-5.0 | active | — | — |
| mongodb-6.0 | active | — | — |
| mongodb-7.0 | active | — | — |

## 解决方案

1. ```
   Increase WiredTiger cache size in mongod.conf: storage.wiredTiger.engineConfig.cacheSizeGB: 4 (adjust based on available RAM). Restart mongod.
   ```
2. ```
   Reduce write load by batching writes or using a write queue. Monitor with db.serverStatus().wiredTiger.cache.
   ```
3. ```
   Add more secondary nodes to distribute read load, reducing cache pressure on primary. Example: rs.add('newSecondary:27017')
   ```

## 无效尝试

- **** — Smaller cache makes eviction pressure worse; the error is caused by insufficient cache, not excess. (80% 失败率)
- **** — This increases risk of data loss and does not address the eviction bottleneck. (90% 失败率)
- **** — If memory is constrained, this can cause OOM kills; the root cause is often eviction efficiency, not cache size. (50% 失败率)
