[SERVER-23378] mmapv1 namespace file allocation needs timing Created: 28/Mar/16  Updated: 06/Dec/22  Resolved: 18/May/17

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

Type: Improvement Priority: Major - P3
Reporter: Mark Benvenuto Assignee: Backlog - Storage Execution Team
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-29284 Log time spent allocating mmap NS files Closed
is duplicated by SERVER-24736 ns file allocations should include ti... Closed
Assigned Teams:
Storage Execution
Backwards Compatibility: Fully Compatible
Participants:

 Description   

While ns files are small at 64MB, allocating them requires us to zero the file. On HDD, the process of file allocation + file zeroing can have a wide variation in performance, and it would be really helpful to time these steps in MongoD to diagnose I/O related problems causing MongoDB to stall.

Example Code:

diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
index 12e90d2..f323bf8 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
@@ -181,6 +181,8 @@ void NamespaceIndex::init(OperationContext* txn) {
         unsigned long long l = mmapv1GlobalOptions.lenForNewNsFiles;
         log() << "allocating new ns file " << pathString << ", filling with zeroes..." << endl;
 
+        Timer nsFileTimer;
+
         {
             // Due to SERVER-15369 we need to explicitly write zero-bytes to the NS file.
             const unsigned long long kBlockSize = 1024 * 1024;
@@ -227,6 +229,10 @@ void NamespaceIndex::init(OperationContext* txn) {
 
             p = _f.getView();
         }
+
+        log() << "done allocating ns file " << pathString << ", "
+              << "size: " << l / 1024 / 1024 << "MB, "
+              << " took " << ((double)nsFileTimer.millis()) / 1000.0 << " secs" << endl;
     }
 
     if (p == 0) {



 Comments   
Comment by Daniel Gottlieb (Inactive) [ 18/May/17 ]

Fixed with SERVER-29284 (my JIRA-fu did not surface this ticket when searching).

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