Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-23378

mmapv1 namespace file allocation needs timing

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • MMAPv1
    • None
    • Fully Compatible

    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) {
      

      Attachments

        Issue Links

          Activity

            People

              backlog-server-execution Backlog - Storage Execution Team
              mark.benvenuto@mongodb.com Mark Benvenuto
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: