mongodb
resource_error
ai_generated
true
MongoServerError: mmapv1 lock acquire timeout
ID: mongodb/mmapv1-lock-acquire-timeout
90%Fix Rate
85%Confidence
1Evidence
2023-03-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| mongodb-3.2 | active | — | — | — |
| mongodb-3.4 | active | — | — | — |
| mongodb-3.6 | active | — | — | — |
Root Cause
With the deprecated MMAPv1 storage engine, a write operation waited too long for a database-level lock due to high concurrency.
generic中文
使用已弃用的 MMAPv1 存储引擎时,由于高并发,写入操作等待数据库级锁超时。
Official Documentation
https://www.mongodb.com/docs/v3.6/faq/storage/#does-mmapv1-have-locking-issuesWorkarounds
-
95% success Migrate to WiredTiger storage engine which uses document-level concurrency.
Migrate to WiredTiger storage engine which uses document-level concurrency.
-
70% success Reduce write concurrency by batching writes or using a queue to serialize operations.
Reduce write concurrency by batching writes or using a queue to serialize operations.
中文步骤
Migrate to WiredTiger storage engine which uses document-level concurrency.
Reduce write concurrency by batching writes or using a queue to serialize operations.
Dead Ends
Common approaches that don't work:
-
80% fail
Increasing lock timeout just delays failure; the underlying contention remains.
-
95% fail
Adding more application threads exacerbates lock contention.