Search code examples
memgraphdb

How to utilize all of the CPU cores in Memgraph?


I've noticed that it's often the case that algorithms inside MAGE are running for a longer period of time but using only one CPU core. I'd like to know how to leverage all available cores on the system? I've checked the docs, but I didn't find any config flags that would could be used.


Solution

  • DISCLAIMER: I'm the co-founder and CTO at Memgraph

    All algorithms inside mage have serial implementations in the first place. Parallel (and/or concurrent) code can often be tricky to get correct and more performant than serial code. But, the Memgraph team aims to provide parallel implementations for every algorithm inside mage. In other words, each algorithm requires a specific implementation to use all available resources on the server. In addition, there are Memgraph cuGraph implementations of some algorithms that utilize the GPU attached to the server (if there is one).

    More broadly, the execution of a single query inside Memgraph is a single thread (at the time of writing, 2023-07-02). There is a plan to support "intraquery" parallelization, but that will also be limited to specific Cypher clauses. Specific mage algorithms will always require special care to make them leverage all available compute resources.