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

dropDatabase very slow due to repeated calls to closeAllCursors

    • Storage Execution
    • Fully Compatible
    • ALL

      Example:

      • dropDatabase with about 70 collections with 2 indexes each for a total of about 200 WT tables
      • about 325k open cursors
      • dropDatabase takes about 30 seconds and holds the global lock the entire time.

      Collecting perf data shows mongod using 100% of a CPU for the duration, all in this stack:

      mongo::WiredTigerSession::closeAllCursors(std::__cxx11::basic_string<...> const&)
      mongo::WiredTigerSessionCache::closeAllCursors(std::__cxx11::basic_string<...> const&)
      mongo::WiredTigerKVEngine::_drop(mongo::StringData)
      mongo::WiredTigerKVEngine::dropIdent(mongo::OperationContext*, mongo::StringData)
      

      For each of the 200 WT tables dropped we call closeAllCursors for that table. The perf stacks show all the time is spent in closeAllCursors itself, and the ftdc metrics also show that we aren't actually closing any cursors, so it appears that all the time is spent by closeAllCursors scanning the list of 325k open cursors to find cursors with a matching table uri.

            Assignee:
            backlog-server-execution [DO NOT USE] Backlog - Storage Execution Team
            Reporter:
            bruce.lucas@mongodb.com Bruce Lucas (Inactive)
            Votes:
            29 Vote for this issue
            Watchers:
            37 Start watching this issue

              Created:
              Updated:
              Resolved: