Skip to content

Memgraph in mission critical workloads #1267

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

Open
wants to merge 67 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
5e5b886
init
katarinasupe Mar 13, 2025
55ff98c
Merge branch 'main' into memgraph-3-2
katarinasupe Mar 28, 2025
17384d2
Merge branch 'main' into memgraph-3-2
katarinasupe Mar 28, 2025
46cfb1f
Add hardware sizing
Josipmrden Apr 15, 2025
ee9a7bb
Add vm.max_map_count explanation
Josipmrden Apr 15, 2025
de342fb
Add deployment options
Josipmrden Apr 15, 2025
0b741e8
Add flag set suggestions
Josipmrden Apr 15, 2025
e8353d3
Indentation
Josipmrden Apr 15, 2025
b63517e
Remove unnecessary comment
Josipmrden Apr 15, 2025
cf434bb
Add enterprise, queries and import sections
Josipmrden Apr 15, 2025
bfc44eb
Finish general suggestions guide
Josipmrden Apr 15, 2025
d3c71fe
Make under construction notes
Josipmrden Apr 15, 2025
1a5097f
Add todo
Josipmrden Apr 15, 2025
5de8cac
Update property sizes
Josipmrden Apr 16, 2025
d63d9d1
Add backup considerations
Josipmrden Apr 16, 2025
fd35d83
Added overview page
Josipmrden Apr 16, 2025
0042907
Add hardware sizing
Josipmrden Apr 15, 2025
6de5e65
Add vm.max_map_count explanation
Josipmrden Apr 15, 2025
60f1f25
Add deployment options
Josipmrden Apr 15, 2025
01f350e
Add flag set suggestions
Josipmrden Apr 15, 2025
74715a8
Indentation
Josipmrden Apr 15, 2025
a97f41a
Remove unnecessary comment
Josipmrden Apr 15, 2025
e8753c1
Add enterprise, queries and import sections
Josipmrden Apr 15, 2025
bcf7a0c
Finish general suggestions guide
Josipmrden Apr 15, 2025
89ce823
Make under construction notes
Josipmrden Apr 15, 2025
6c5e47f
Add todo
Josipmrden Apr 15, 2025
84f4d0c
Update property sizes
Josipmrden Apr 16, 2025
51f07a4
Add backup considerations
Josipmrden Apr 16, 2025
2d481aa
Added overview page
Josipmrden Apr 16, 2025
0126e49
Merge branch 'memgraph-in-production' of github.com:memgraph/document…
Josipmrden Apr 16, 2025
81d7788
Main
Josipmrden Apr 16, 2025
72f6649
Main
Josipmrden Apr 16, 2025
c27b99d
Newline
Josipmrden Apr 16, 2025
6d1c3c3
Merge branch 'main' into memgraph-in-production
Josipmrden Apr 16, 2025
c58d7c5
Add section for query timeout
Josipmrden Apr 17, 2025
6742f61
Set up lab features
Josipmrden Apr 17, 2025
5cedea6
Sentence case
Josipmrden Apr 17, 2025
2a3aa4e
Remove empty construction pages
Josipmrden Apr 17, 2025
313e61b
Add callout
Josipmrden Apr 17, 2025
1b5c5f3
Update GraphRAG use case
Josipmrden Apr 17, 2025
05e8b71
Finish memgraph in production for graphrag
Josipmrden Apr 24, 2025
2c7e98f
Merge branch 'main' into memgraph-in-production
Josipmrden Apr 24, 2025
52485ac
Update initial page
Josipmrden Apr 24, 2025
7f2fcb2
Add graphrag link
Josipmrden Apr 24, 2025
44518e5
Merge branch 'memgraph-in-production' into evaluating-memgraph
Josipmrden Apr 24, 2025
f3b0c5c
Add page for evaluating memgraph -> mgbench
Josipmrden Apr 24, 2025
53e1526
Address PR comments
Josipmrden Apr 25, 2025
4a4c77a
Merge branch 'memgraph-in-production' into evaluating-memgraph
Josipmrden Apr 25, 2025
f2f4ff7
Add title for evaluating memgraph
Josipmrden Apr 25, 2025
5a828ad
Address PR comments
Josipmrden Apr 25, 2025
ae10ec9
Add contents before the deep-dive
Josipmrden Apr 25, 2025
b07865d
Edit titles
Josipmrden Apr 25, 2025
be53774
Add guidelines for updating the page
Josipmrden Apr 25, 2025
e9ce4ce
Finish guide for high throughput workloads
Josipmrden Apr 26, 2025
7c5fc5a
Omit constructed guide
Josipmrden Apr 26, 2025
bdc9514
Add initial mission critical page
Josipmrden Apr 26, 2025
c43bcd0
Omit guide being constructed
Josipmrden Apr 26, 2025
f6150f7
Dash
Josipmrden Apr 28, 2025
99a1ab2
Merge branch 'main' into memgraph-in-high-throughput-workloads
Josipmrden Apr 28, 2025
9d92156
Merge branch 'main' into memgraph-in-high-throughput-workloads
matea16 Apr 28, 2025
0ef77f4
Address PR commnets
Josipmrden Apr 28, 2025
fc5fbbc
Push memgraph up
Josipmrden Apr 28, 2025
17d25a8
Fix link for benchmarking Memgraph
Josipmrden Apr 28, 2025
4f0d144
Merge branch 'memgraph-in-high-throughput-workloads' into memgraph-in…
Josipmrden Apr 28, 2025
3b710e6
Merge branch 'main' into memgraph-in-mission-critical-workloads
Josipmrden Aug 18, 2025
070291a
Add guide for mission critical workloads
Josipmrden Aug 18, 2025
6b68ac7
Link backup and restore
Josipmrden Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pages/deployment/benchmarking-memgraph.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ While `mgbench` gives you full control over benchmarking and produces raw result
analyzing performance metrics at scale can be time-consuming. That’s why we created
[**Benchgraph**](https://github.com/memgraph/benchgraph)—a companion visualization tool for `mgbench`.

![](/pages/memgraph-in-production/benchmarking-memgraph/benchgraph-snippet.png)
![](/pages/deployment/benchmarking-memgraph/benchgraph-snippet.png)

Benchgraph is not required to use `mgbench`, but it offers a **convenient way to visualize and explore**
benchmark results across a variety of run conditions:
Expand Down
1 change: 1 addition & 0 deletions pages/deployment/workloads/_meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ export default {
"memgraph-in-cybersecurity": "Memgraph in cybersecurity",
"memgraph-in-graphrag": "Memgraph in GraphRAG use cases",
"memgraph-in-high-throughput-workloads": "Memgraph in high-throughput workloads",
"memgraph-in-mission-critical-workloads": "Memgraph in mission critical workloads",
}
2 changes: 1 addition & 1 deletion pages/deployment/workloads/memgraph-in-cybersecurity.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Here's why Memgraph is a great fit for cybersecurity use cases:
While many graph databases **max out around 1,000 events per second**, Memgraph can handle **up to 50x more**
(see image below), making it ideal for **high-velocity security event processing**.

![](/pages/memgraph-in-production/benchmarking-memgraph/realistic-workload.png)
![](/pages/deployment/benchmarking-memgraph/realistic-workload.png)

- **Non-blocking reads and writes with MVCC**: Built on multi-version concurrency control (MVCC),
Memgraph ensures that **security event ingestion doesn't block threat analysis** and **analysis doesn't block ingestion**,
Expand Down
2 changes: 1 addition & 1 deletion pages/deployment/workloads/memgraph-in-graphrag.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Here's what makes Memgraph a perfect fit for GraphRAG:
## What is covered?

The suggestions for GraphRAG use cases **complement** several key sections in the
[general suggestions guide](/memgraph-in-production/general-suggestions). These sections offer important context and
[general suggestions guide](/deployment/best-practices). These sections offer important context and
additional best practices tailored for performance, stability, and scalability in GraphRAG systems:

- [Hardware sizing](#hardware-sizing)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Here's why Memgraph is a great fit for high-throughput use cases:
While many graph databases **max out around 1,000 writes per second**, Memgraph can handle **up to 50x more**
(see image below), making it ideal for **high-velocity, write-intensive workloads**.

![](/pages/memgraph-in-production/benchmarking-memgraph/realistic-workload.png)
![](/pages/deployment/benchmarking-memgraph/realistic-workload.png)

- **Non-blocking reads and writes with MVCC**: Built on multi-version concurrency control (MVCC),
Memgraph ensures that **writes don’t block reads** and **reads don’t block writes**, allowing each to scale independently.
Expand All @@ -71,7 +71,7 @@ Here's why Memgraph is a great fit for high-throughput use cases:
## What is covered?

The suggestions for high-throughput workloads **complement** several key sections in the
[general suggestions guide](/memgraph-in-production/general-suggestions). These sections offer important context and
[best practices guide](/deployment/best-practices). These sections offer important context and
additional best practices tailored for performance, stability, and scalability in high-throughput systems:

- [Choosing the right Memgraph flag set](#choosing-the-right-memgraph-flag-set) <br />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
---
title: Memgraph in mission-critical workloads
description: Suggestions on how to bring your Memgraph to production in mission-critical and high-availability workloads.
---

import { Callout } from 'nextra/components'
import { CommunityLinks } from '/components/social-card/CommunityLinks'

# Memgraph in mission-critical workloads

<Callout type="info">
👉 **Start here first**
Before diving into this guide, we recommend starting with the [**Best practices**](/deployment/best-practices)
page. It provides **foundational, use-case-agnostic advice** for deploying Memgraph in production.

This guide builds on that foundation, offering **additional recommendations tailored to critical and high-availability workloads**.
In cases where guidance overlaps, consider the information here as **complementary or overriding**, depending
on the unique needs of your use case.
</Callout>

## Is this guide for you?

This guide is for you if you're building **mission-critical systems** where uptime, data consistency, and fault tolerance are essential.
You’ll benefit from this content if:

- 🛡️ You require **high availability** and **automatic failover** for your application.
- 🔒 You need **strong consistency guarantees** even under heavy loads.
- 🔁 You must **recover gracefully** from unexpected failures without data loss.
- 🏢 You need to **support multi-tenant environments** securely across multiple projects or customers.

If this matches your needs, this guide will help you configure and operate Memgraph to meet the demands of **always-on production environments**.

## Why choose Memgraph for mission-critical use cases?

When stability, consistency, and resilience matter most, Memgraph is built to deliver. Here's why Memgraph is a great fit for mission-critical workloads:

- **In-memory storage engine with persistence**
Memgraph keeps the working set fully in memory for fast access, while ensuring **durability** through **periodic snapshots** and **write-ahead logging (WALs)** in transactional mode.
Keeping the data in memory ensures lightning speed in times when you expect everything to function seamlessly and without issues during peak times of your critical service.

- **High availability with automatic failover**
Memgraph supports full [**high availability clustering**](/clustering/high-availability), allowing you to deploy **multiple instances** with automatic **leader election** and **failover** when needed.
Deploying Memgraph with high availability will ensure Memgraph is up and running at all times, without compromising uptime of your services.

- **Multi-version concurrency control (MVCC)**
Built on **MVCC**, Memgraph allows **non-blocking reads and writes**, ensuring that your system remains **responsive** even under concurrent access. Writes are not blocking reads, and vice versa.

- **Snapshot isolation by default**
Memgraph uses **snapshot isolation** instead of **read-committed** isolation, preventing dirty reads and guaranteeing a **consistent view** of the graph at all times.

- **Replication for read scaling and redundancy**
Memgraph supports **asynchronous replication**, enabling you to **scale read workloads** independently while ensuring **failover readiness**. For a more consistent view of the data, it
also supports **synchronous replication** which prioritizes consistency over scalability.

- **Fine-grained access control and security**
Secure your system with [**role-based access control**](/database-management/authentication-and-authorization/role-based-access-control) and
[**label-based access control**](/database-management/authentication-and-authorization/role-based-access-control#label-based-access-control) to ensure only the right users see and manipulate data.

## What is covered?

The suggestions for mission-critical workloads **complement** several key sections in the
[general suggestions guide](/deployment/best-practices), with additional best practices to ensure uptime and data protection:

- [Choosing the right Memgraph flag set](#choosing-the-right-memgraph-flag-set)
Memgraph offers flags to enhance recovery, snapshot management, and failover capabilities.

- [Choosing the right Memgraph storage mode](#choosing-the-right-memgraph-storage-mode)
Guidance on selecting the **safest** and **most consistent** storage configurations.

- [Enterprise features you might require](#enterprise-features-you-might-require)
Overview of **replication**, **multi-tenancy**, and **automatic failover** tools that are critical in production.

- [Backup and recovery mechanisms](#backup-and-recovery-mechanisms)
Best practices to protect your data through snapshots, WALs, and external backup strategies.

- [Queries that best suit your workload](#queries-that-best-suit-your-workload)
Designing queries that maintain consistent, safe, and predictable behavior in high-availability systems.

## Choosing the right Memgraph flag set

For mission-critical setups, you should configure Memgraph to optimize for **durability, fast recovery**, and **stability**. Some important flags include:

- `--storage-snapshot-interval-sec=x`
Set how often snapshots are created. In mission-critical systems, you may want **frequent snapshots** to minimize recovery time.

- `--storage-wal-enabled=true`
Ensure **WALs (write-ahead logs)** are enabled to protect all transactions between snapshots.

- `--storage-parallel-schema-recovery=true` and `--storage-recovery-thread-count=x`
Enable **parallel recovery** to speed up startup time after a crash by using multiple cores.

- `--query-execution-timeout-sec=x`
Set reasonable query timeouts to **avoid stuck queries** and prevent resource exhaustion.`

## Choosing the right Memgraph storage mode

For mission-critical deployments:

- Always use `IN_MEMORY_TRANSACTIONAL` mode.
- This mode provides **full ACID guarantees**, **WAL support**, and **snapshot consistency**.

<Callout type="info">
`IN_MEMORY_ANALYTICAL` is optimized for high-speed ingestion but does **not provide transactional durability**. It is not recommended for mission-critical workloads.
</Callout>

## Importing mechanisms
Importing mechanisms are best described in the [guide for high-throughput workloads](/deployment/workloads/memgraph-in-high-throughput-workloads).
The rule of thumb is to always setup the drivers to perform retries if you're doing heavy amount of writes, in order to avoid read conflicts.
The high throguhput guide also outlines the need for idempotent queries, to ensure data consistency if writes fail for any reason.

## Enterprise features you might require

For robust production environments, consider enabling:

- **High availability clustering** ([learn more](/clustering/high-availability))
Deploy multiple Memgraph instances with automatic leader election and failover.

- **Replication for resilience**
Distribute replicas geographically or across availability zones to minimize the risk of localized outages.

- **Role-based and label-based access control** ([learn more](/database-management/authentication-and-authorization/role-based-access-control))
Protect sensitive graph data and ensure only authorized operations are performed.

- **Multi-tenancy** ([learn more](/database-management/multi-tenancy))
Securely isolate data and permissions between different teams, projects, or customers.

## Backup and recovery mechanisms

Data durability is critical in mission-critical environments. Memgraph supports:

- **Snapshots**
Automatically or manually triggered full-database snapshots.

- **Write-ahead logging (WALs)**
Transaction logs that enable you to **replay changes** made after the last snapshot.

- **Manual backup and offloading**
Use external tools (like [`rclone`](https://rclone.org/)) to back up snapshots and WALs to **cloud storage** or **remote servers** for additional redundancy.

<Callout type="info">
Memgraph currently does not automate backing up data to 3rd party locations, so integrating a backup process into your
system is highly recommended.
</Callout>

<Callout type="info">
Learn more about backup and restore [on our backup and restore documentation page](/database-management/backup-and-restore).
</Callout>

## Queries that best suit your workload

In mission-critical workloads:

- Prefer **idempotent writes** (`MERGE`) to avoid inconsistent state during retries.
- Optimize long-running queries and **profile** them regularly ([learn more](/querying/clauses/profile)).
- Avoid complex, unpredictable queries inside critical transactional paths.
- Use **schema constraints** and **indexes** wisely to enforce data integrity without hurting performance.

Example of safe, idempotent data ingestion:

```cypher
MERGE (n:Customer {id: $id})
SET n += $props;
```
<CommunityLinks/>