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

Very short timeout for select() call in net listener eats up CPU time

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 1.9.2, 2.0.8, 2.1.2, 2.2.2, 2.3.1
    • Fix Version/s: None
    • Labels:
    • Environment:
      Linux
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      Run strace on idle mongod - see 100 select() calls each second. Top will show CPU usage.

      Show
      Run strace on idle mongod - see 100 select() calls each second. Top will show CPU usage.

      Description

      The select() call at src/mongo/util/net/listen.cpp:218 is made with a timeout of 10ms, which is unnecessarily small, and, on one of my machines, results in a constant CPU consumption of >1% when mongod is sitting idle.

      Eliminate the timeout altogether: just pass NULL and let select() block until something happens. The timeout specified here is unnecessary, as a timeout simply results in select() being called again.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              jcalvinowens Calvin Owens
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: