Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Associating threadpool queues with CPU cores. #18403

Closed
wants to merge 5 commits into from
Closed

Commits on Nov 1, 2019

  1. New implementation of ThreadPool work queues as lock-free queues soft…

    …ly associated with CPU cores.
    
        The implementation avoids 1:1 strict mapping between work queues and working threads which is often a far greater number than the number of cores.
    
        This implementation improves handling of cases where the number of workers needs to exceeds the number of cores and causes precipitous performance drops because:
        - the cost of snooping/stealing does not grow with the number of workers.
        - the local queues tend to be deeper (since there are fewer of them) and thus stealing is less frequent and less contentious with enqueuing/popping.
        - reduced likelihood that the workitem will have to execute on a core different from where it was scheduled.
    VSadov committed Nov 1, 2019
    Configuration menu
    Copy the full SHA
    0174df3 View commit details
    Browse the repository at this point in the history
  2. In a rare case when local queue has multiple segments, do a local Deq…

    …ueue to ensure that continuously nonempty global queue does not delay retirement of old segments.
    
    This is not a very common scenario, generally happening only at start up, but mitigation is also simple.
    VSadov committed Nov 1, 2019
    Configuration menu
    Copy the full SHA
    d6dd274 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f5095c7 View commit details
    Browse the repository at this point in the history
  4. Constrain how many tasks may be dispatched from a "wrong" queue.

    Moving to a different core while dispatching is a rare occurence, but when it does happen we do not want to neglect our local queue for too long since that can result in a batch of high-latency outliers.
    VSadov committed Nov 1, 2019
    Configuration menu
    Copy the full SHA
    991c2eb View commit details
    Browse the repository at this point in the history
  5. some PR feedback.

    VSadov committed Nov 1, 2019
    Configuration menu
    Copy the full SHA
    fe91b49 View commit details
    Browse the repository at this point in the history