[SERVER-3588] Be smarter about opening databases Created: 12/Aug/11  Updated: 06/Dec/22  Resolved: 14/Sep/18

Status: Closed
Project: Core Server
Component/s: MMAPv1, Storage
Affects Version/s: 1.6.5, 1.8.2
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Backlog - Storage Execution Team
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Storage Execution
Participants:

 Description   

Copied from http://groups.google.com/group/mongodb-user/browse_thread/thread/a1b73e36b6be0b92 :

When number of database grow large, mongod will spent very long time to start.
I have about 23500 databases in dbpath, and starting mongod will spent about 45 mins.
I read the source code of mongod and used strace to watch what mongod do while starting. I found that mongod open all databases to check the pdfile version while starting. When mongod open a database, it call "getDatabaseNames", and "getDatabaseNames" will call file stat for about N (N is the number of databases) times. So mongod will call stat about N * N times while checking the pdfile version of all databases. This will spent too long time.


Generated at Thu Feb 08 03:03:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.