Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed size ThreadPool scheduler #20808

Open
wants to merge 52 commits into
base: devel
Choose a base branch
from
Open

Conversation

maierlars
Copy link
Collaborator

@maierlars maierlars commented Apr 3, 2024

Scope & Purpose

This PR implements a new ThreadPoolScheduler with a fixed number of threads, and a number of different thread pools. The ThreadPoolScheduler creates a separate thread pool for each priority lane.

We have the following thread pools:

  • SimpleThreadPool - this is a very simple thread pool with a std::queue, mutex + condition variable
  • LockFreeThreadPool - this one is similar to the SimpleThreadPool but replaces the std::queue with a boost::lockfree::queue
  • WorkStealingThreadPool - this is a first version of a work stealing pool where instead of a globally shared queue, each thread has a local queue

This PR also implements a number of synthetic benchmarks as tests (by default these are disabled so that they do not run durng regular builds). These benchmarks showed, that the WorkStealingThreadPool scales significantly better than the other two thread pools, and also much better then the current SupervisedScheduler.

@maierlars maierlars self-assigned this Apr 3, 2024
@cla-bot cla-bot bot added the cla-signed label Apr 3, 2024
@maierlars maierlars force-pushed the feature/thread-pool-scheduler branch from f9a3e4e to 35d0162 Compare April 3, 2024 13:15
@maierlars maierlars force-pushed the feature/thread-pool-scheduler branch from 35d0162 to d2994c5 Compare April 4, 2024 10:23
@maierlars maierlars marked this pull request as ready for review April 6, 2024 09:09
@maierlars maierlars marked this pull request as draft April 8, 2024 12:12
Copy link
Member

@goedderz goedderz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soo much simpler 😍

arangod/Scheduler/SimpleThreadPool.cpp Outdated Show resolved Hide resolved
arangod/Scheduler/SimpleThreadPool.cpp Outdated Show resolved Hide resolved
@mpoeter mpoeter marked this pull request as ready for review May 23, 2024 08:04
@mpoeter mpoeter requested review from a team as code owners May 23, 2024 08:04
@jsteemann jsteemann added this to the devel milestone May 23, 2024
Copy link
Contributor

@jsteemann jsteemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants