Info
Startup opens all databases, and for each opened database, it compares it against all previously opened databases to check for duplicates. This is quadratic. A test opening 50k databases takes about a minute; with 100k databases, it takes over ten minutes.
Top User Comments
xgen-internal-githook commented on Fri, 27 Oct 2023 15:57:54 +0000:
Author:
{'name': 'David Dominguez-Sal', 'email': 'david.dominguez@mongodb.com', 'username': ''}
Message: SERVER-81094 Added new indexation in DatabaseImpl for constant time location of conflicting databases by name
Branch: master
https://github.com/mongodb/mongo/commit/2d7f612e46c0469fca43069b5a3fcde9e68b9439
JIRAUSER1275231 commented on Fri, 27 Oct 2023 15:14:42 +0000:
Added a new index to provide constant complexity for name collision lookup
JIRAUSER1275231 commented on Tue, 17 Oct 2023 10:28:12 +0000:
The new implementation takes constant time to open a DB. So, the growth is now linear instead of quadratic.
Performance test for DatabaseImpl::openDB:
Old implementation
Tables
Time[ms]
100
0
1000
5
5000
129
10000
583
50000
25782
100000
110487
New implementation
Tables
Time[ms]
100
0
1000
2
5000
9
10000
17
50000
94
100000
195