[SERVER-17611] coll.createIndex on empty collection lasts 50-100 ms (vs 1 ms with Vers. 2) Created: 16/Mar/15  Updated: 19/Mar/15  Resolved: 17/Mar/15

Status: Closed
Project: Core Server
Component/s: Performance
Affects Version/s: 3.0.0
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jochen Brüggemann Assignee: Ramon Fernandez Marina
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

When creating a new (empty) collection we also create all corresponding indexes. This was used to take about 1 ms with mongoDB V2. With V3 this now takes between 50 and 150 ms. Is this a bug or a feature?



 Comments   
Comment by Eliot Horowitz (Inactive) [ 17/Mar/15 ]

MMAP 3.0 and MMAP 2.6 should have the same performance for this test.

WiredTiger will be slower as to create a new collection with one index allocates 2 files.
This is because each collection and index in WT is stored in a different file.
This requires a few file system calls, which can take some time.

For MMAP, all the data and indexes for an entire database live in the same files, so for this test its a good bit faster.

Not really a bug or a feature, just an artifact of some implementation choices that makes sense for each engine.

Comment by Jochen Brüggemann [ 17/Mar/15 ]

Both are standalone. One is 3.0.0 (compressed/WiredTiger), the other is 2.6.8. Both have a database named "test" with an empty collection "test" with no indexes. On both we execute the following script:

var t = new Date();
db.test.createIndex({test:1},{})
print("Completed in ms:",new Date()-t);

On 2.6.8 this lasts 1 ms. On 3.0.0. this lasts > 50 ms.

Comment by Ramon Fernandez Marina [ 16/Mar/15 ]

redmedical, unfortunately there's not enough information above to determine if this is a regression. Can you please send us details on how you're starting up your deployment, what kind of deployment is it (replica set, standalone), and what are the exact operations where you see the 50-150ms delay?

Thanks,
Ramón.

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