Consider replacing/refactoring log() streams.

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.0.7, 2.2.0
    • Component/s: Logging
    • Environment:
      All
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently, all log messages are implemented using streams and manipulators. This is problematic when a function is passed to a log() stream (because the function will be called regardless of the log level or use of NullStreams).

      Take, for example, this seemingly innocuous line:

                  log( pc ) << "finishing on shard " << shard << ", current connection state is " << mdata << endl;
      

      Because mdata is of type ParallelConnectionMetadata, and defines a toString() method which calls toBSON(), we waste CPU time (and malloc/free much more than necessary) even if verbose logging is disabled.

      To gauge impact, the supplied patch was applied. A simple stress test which floods mongos with simple find() operations performed 6500 queries per second unpatched, and 7600 queries per second with the patch.

              Assignee:
              Unassigned
              Reporter:
              Ben Becker (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: