mongodb resource_error ai_generated true

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

WiredTiger error (0) - cache stuck: eviction worker thread stalled for 120 seconds

ID: mongodb/wiredtiger-cache-eviction-stall

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
1证据数
2023-09-01首次发现

版本兼容性

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

根因分析

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

English

WiredTiger cache is full and eviction cannot keep up, often due to high write load or insufficient cache size.

generic

官方文档

https://www.mongodb.com/docs/manual/reference/log-messages/#std-label-log-message-wt-eviction-stall

解决方案

  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')

无效尝试

常见但无效的做法:

  1. 80% 失败

    Smaller cache makes eviction pressure worse; the error is caused by insufficient cache, not excess.

  2. 90% 失败

    This increases risk of data loss and does not address the eviction bottleneck.

  3. 50% 失败

    If memory is constrained, this can cause OOM kills; the root cause is often eviction efficiency, not cache size.