Skip to content

Conversation

andrejtonev
Copy link
Contributor

@andrejtonev andrejtonev commented Dec 20, 2024

Bolt worker pool has been separated from the boost::asio communication stack
While the communication still relies on boost::asio, it is only used to queue tasks onto the new scheduler
PriorityThreadPool is a new class that can order tasks by priority and execute them on N threads + 1 sidecar thread
The sidecar thread is used for high priority tasks only and is a workaround because tasks cannot yield at the moment
This allows us to never block a connection and to always execute selection of high priority queries
Deprecated --bolt-session-inactivity-timeout flag
New hidden flag --scheduler which allows user to select between priority_queue and asio

@andrejtonev
Copy link
Contributor Author

andrejtonev commented Dec 20, 2024

Tracking

  • [Link to Epic/Issue]

Standard development

CI Testing Labels

  • Select the appropriate CI test labels (CI -build=build-name -test=test-suite)

Documentation checklist

  • Add the documentation label
  • Add the bug / feature label
  • Add the milestone for which this feature is intended
    • If not known, set for a later milestone
  • Write a release note, including added/changed clauses
    • New bolt work scheduler based on a priority queue with a sidecar channel for high priority queries. Users should never see a blocked database due to heavy load. Users can now run specific high priority queries even under heavy loads (example: SHOW TRANSACTIONS). 2567
  • Scheduler docs documentation#1302
    • Is back linked to this development PR
  • @katarinasupe @gitbuda
@andrejtonev andrejtonev self-assigned this Dec 20, 2024
@andrejtonev andrejtonev added feature feature Docs needed Docs needed CI -build=community -test=core Run community build and core tests on push CI -build=coverage -test=core Run coverage build and core tests on push CI -build=debug -test=core Run debug build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=stress Run release build and stress tests on push labels Dec 20, 2024
@gitbuda gitbuda added this to the mg-v3.0.0 milestone Dec 30, 2024
@andrejtonev andrejtonev added the CI -build=release -test=benchmark Run release build and benchmark on push label Jan 3, 2025
@andrejtonev andrejtonev force-pushed the custom_worker_pool branch 2 times, most recently from 9284d5c to 8f20e94 Compare January 23, 2025 10:20
@gitbuda gitbuda modified the milestones: mg-v3.0.0, mg-v3.1.0 Jan 27, 2025
@andrejtonev andrejtonev removed CI -build=community -test=core Run community build and core tests on push CI -build=coverage -test=core Run coverage build and core tests on push CI -build=debug -test=core Run debug build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=stress Run release build and stress tests on push labels Feb 16, 2025
@andrejtonev andrejtonev force-pushed the custom_worker_pool branch 3 times, most recently from 5561953 to ad24b0a Compare February 17, 2025 21:03
Moved worker pool to memgraph.cpp from Server Removed pool's pointer from ServerContext and Session SessionContext now has pool's pointer and a function to help add tasks Removed unused code from ChunkedDecoderBuffer Comments and general cleanup
Removed TypedValueResultStreamBase and DecodeValue	unused due to MesssageRecord split Prepare doesn't assert but throws on missing parsed_res_	Should never happen, just in case General celan up
worker pool AwaitShutdown better names and general cleanup
Moved SimpleBarrier to its own header	Redesign using wait and notify	Unit tests Moved yielder to its own header and unified with RWSpinLock one
Hot threads reorganized into a class HotMaks unit tests
Bugfix in sched_mon not detecting last_task (introduced in prev cleanup) HIGH only specific query types unit tests
andrejtonev and others added 2 commits April 29, 2025 21:30
Bugfix: Worker destoryed before safe	- Worker was part of the operator() which exits on shutdown	- Every worker has a vector of other workers	- Worker can be destoryed only after each thread exited	- workers_ is now a unique_ptr unit test fix
@andrejtonev andrejtonev changed the title WIP: Communication stack improvements Scheduler based on priority queue and communication stack improvements May 5, 2025
@andrejtonev andrejtonev marked this pull request as ready for review May 5, 2025 12:06
New command-line HIDDEN flag `scheduler` New e2e test
@andrejtonev andrejtonev force-pushed the custom_worker_pool branch from 306a73d to bd9b333 Compare May 5, 2025 15:38
@andrejtonev andrejtonev added this pull request to the merge queue May 12, 2025
Merged via the queue into master with commit 1af5a81 May 12, 2025
17 checks passed
@andrejtonev andrejtonev deleted the custom_worker_pool branch May 12, 2025 12:54
@gitbuda gitbuda mentioned this pull request Jun 3, 2025
16 tasks
@andrejtonev andrejtonev linked an issue Jun 26, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI -build=community -test=core Run community build and core tests on push CI -build=coverage -test=core Run coverage build and core tests on push CI -build=debug -test=integration Run debug build and integration tests on push CI -build=jepsen -test=core Run jepsen build and core tests on push CI -build=release -test=benchmark Run release build and benchmark on push CI -build=release -test=e2e Run release build and e2e tests on push CI -build=release -test=query_modules Run release build and query modules tests on push CI -build=release -test=stress Run release build and stress tests on push Docs needed Docs needed feature feature

3 participants