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

More graceful sleeping in executor on detecting source idleness

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Atlas Streams
    • Fully Compatible
    • Sprint 66
    • 200

      Today, if we detect a source is idle, we will immediately cause the executor loop to sleep for 100 ms. With this behavior, we are likely seeing latency hits in workloads where we do not have a constant stream of input docs.

      We can instead make this behavior more smoother by sleeping only if the source is idle for the last X millis or for the last X tries etc. The sleep duration can also start off small and increase for every consecutively idle period till it hits the max of 100ms.

      So, something like this:

      sleepMs := 0;
      sourceLastActiveAt := 0;
      while(true) {
      sourceIdle := runLoopOnce()
      if(!sourceIdle) {
        sourceLastActiveAt := now();
        sleepMs := 0;
      } else {
        int intervals = (now() - sourceLastActiveAt)/10ms - 1;
        if(intervals >= 0) {
          sleepMs := min(2^^intervals , 100ms);
        }
      }
      sleepFor(sleepMs);
      }
      

            Assignee:
            matthew.normyle@mongodb.com Matthew Normyle
            Reporter:
            mayuresh.kulkarni@mongodb.com Mayuresh Kulkarni
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: