-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.4.3
-
Component/s: Performance
-
Fully Compatible
-
v6.0, v5.0, v4.4
-
Execution Team 2021-12-13, Execution Team 2021-12-27, Execution Team 2022-01-10, Execution Team 2022-01-24, Execution Team 2022-02-07, Execution Team 2022-02-21, Execution Team 2022-03-07, Execution Team 2022-03-21, Execution Team 2022-04-04, Execution Team 2022-04-18, Execution Team 2022-05-02
-
(copied to CRM)
-
105
Even though view creation is rather fast, in my experiment it took 100 seconds to create 5000 views, view creation degrades over time. Currently, we take collection MODE_X lock and need to reload the view catalog during each view creation.
The script I used is a single-threaded view creation but running the same script against different collections in parallel does not improve the total execution time as it seems that reloading the view catalog is the bottleneck.
Repro:
function main() { var views_to_create = 5000; print("Starting..."); db = db.getSiblingDB("views_db"); db.dropDatabase(); print("DB Dropped"); var coll_name = "my_collection"; db.createCollection(coll_name); print("DB/Collection Created"); var results=[]; for (var i=0; i < views_to_create; i=i+1){ var field = 'field_' + Math.floor(Math.random() * 10000).toString(); var pipeline = [{'$project': { }}]; pipeline[0]['$project'][field] = '$a'; var start = new Date(); db.runCommand({"create": "view_" + i, "viewOn": coll_name, "pipeline": pipeline}); var end = new Date(); if (i % 100 == 0){ print ((end-start) + " taken for creating view " + i); } } } main();
- causes
-
SERVER-66355 Pass dbName to validateViewDefinitionBSON in DurableViewCatalog::onExternalInsert
- Closed
- is duplicated by
-
SERVER-53925 view creation performance decreases with increasing number of views
- Closed
- is related to
-
SERVER-78615 Poor view drop performance leads to replication lag
- Blocked
- related to
-
SERVER-63696 Replace generic DurableViewCatalog::onExternalChange handler with operation-specific handlers
- Backlog
-
SERVER-77572 Create workload to test create and drop of many views
- Backlog