Skip to content

Commit 83b790f

Browse files
Josipmrdenkatarinasupematea16
authored
Memgraph in mission critical workloads (#1267)
* init * Add hardware sizing * Add vm.max_map_count explanation * Add deployment options * Add flag set suggestions * Indentation * Remove unnecessary comment * Add enterprise, queries and import sections * Finish general suggestions guide * Make under construction notes * Add todo * Update property sizes * Add backup considerations * Added overview page * Add hardware sizing * Add vm.max_map_count explanation * Add deployment options * Add flag set suggestions * Indentation * Remove unnecessary comment * Add enterprise, queries and import sections * Finish general suggestions guide * Make under construction notes * Add todo * Update property sizes * Add backup considerations * Added overview page * Main * Main * Newline * Add section for query timeout * Set up lab features * Sentence case * Remove empty construction pages * Add callout * Update GraphRAG use case * Finish memgraph in production for graphrag * Update initial page * Add graphrag link * Add page for evaluating memgraph -> mgbench * Address PR comments * Add title for evaluating memgraph * Address PR comments * Add contents before the deep-dive * Edit titles * Add guidelines for updating the page * Finish guide for high throughput workloads * Omit constructed guide * Add initial mission critical page * Omit guide being constructed * Dash * Address PR commnets * Push memgraph up * Fix link for benchmarking Memgraph * Add guide for mission critical workloads * Link backup and restore * Apply suggestions from code review * update main page --------- Co-authored-by: katarinasupe <[email protected]> Co-authored-by: Katarina Supe <[email protected]> Co-authored-by: Matea Pesic <[email protected]> Co-authored-by: matea16 <[email protected]>
1 parent e1d10bb commit 83b790f

File tree

9 files changed

+258
-19
lines changed

9 files changed

+258
-19
lines changed

pages/deployment/benchmarking-memgraph.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ While `mgbench` gives you full control over benchmarking and produces raw result
6262
analyzing performance metrics at scale can be time-consuming. That’s why we created
6363
[**Benchgraph**](https://github.com/memgraph/benchgraph)—a companion visualization tool for `mgbench`.
6464

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

6767
Benchgraph is not required to use `mgbench`, but it offers a **convenient way to visualize and explore**
6868
benchmark results across a variety of run conditions:

pages/deployment/workloads.mdx

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ import {CommunityLinks} from '/components/social-card/CommunityLinks'
88

99
# Workloads
1010

11-
When deploying Memgraph in production, it is essential to consider a set of prerequisites to ensure optimal **performance**, **scalability**
12-
and **resilience**. That includes decisions about hardware configurations and integration strategies.
11+
When deploying Memgraph in production, it is essential to consider a set of
12+
prerequisites to ensure optimal **performance**, **scalability** and
13+
**resilience**. That includes decisions about hardware configurations and
14+
integration strategies.
1315

14-
This section provides guides that are the starting point to production-readiness with Memgraph.
16+
This section provides guides that are the starting point to production-readiness
17+
with Memgraph.
1518

1619
Before you dive into specific setups, it's important to think about:
1720
- **Hardware requirements** and **instance sizing**
@@ -20,18 +23,23 @@ Before you dive into specific setups, it's important to think about:
2023
- **Data import** best practices
2124
- Connecting to **external sources**
2225

23-
These factors ensure Memgraph performs effectively in your environment, no matter the use case.
26+
These factors ensure Memgraph performs effectively in your environment, no
27+
matter the use case.
2428

2529
## How to use these guides
2630

27-
**Start with the [Deployment best practices](/deployment/best-practices)**. That page covers the **best practices** that apply to most
28-
production deployments, regardless of your workload type and are **agnostic to specific use cases**.
29-
Each separate guide in the Workloads section focuses on a particular type of workload or deployment scenario.
30-
At the beginning of each guide, you’ll learn when that **use case** is a good fit for your needs and specific tailored **recommendations**.
31+
**Start with the [Deployment best practices](/deployment/best-practices)**. That
32+
page covers the **best practices** that apply to most production deployments,
33+
regardless of your workload type and are **agnostic to specific use cases**.
34+
Each separate guide in the Workloads section focuses on a particular type of
35+
workload or deployment scenario. At the beginning of each guide, you’ll learn
36+
when that **use case** is a good fit for your needs and specific tailored
37+
**recommendations**.
3138

3239
<Callout type="warning">
33-
Recommendations in those guides **override** anything written in the
34-
general suggestions when there's a conflict, so always defer to the targeted guide when applicable.
40+
Recommendations in those guides **override** anything written in the general
41+
suggestions when there's a conflict, so always defer to the targeted guide when
42+
applicable.
3543
</Callout>
3644

3745
## Available guides
@@ -42,20 +50,26 @@ Here are the currently available guides to help you deploy Memgraph effectively:
4250
Learn how to utilize memgraph across your cyber security network.
4351

4452
### [Memgraph in high-throughput workloads](/deployment/workloads/memgraph-in-high-throughput-workloads)
45-
Scale your write throughput while keeping up with fast-changing, high-velocity graph data.
53+
Scale your write throughput while keeping up with fast-changing, high-velocity
54+
graph data.
4655

4756
### [Memgraph in GraphRAG use cases](/deployment/workloads/memgraph-in-graphrag)
48-
Learn how to optimize Memgraph for Retrieval-Augmented Generation (RAG) systems using graph data.
57+
Learn how to optimize Memgraph for Retrieval-Augmented Generation (RAG) systems
58+
using graph data.
59+
60+
### [Memgraph in mission critical workloads](/deployment/workloads/memgraph-in-mission-critical-workloads)
61+
Learn how to configure Memgraph for high availability, strong consistency, and
62+
fault tolerance in mission-critical production environments.
4963

5064
## 🚧 Guides in construction
5165
- Memgraph in transactional workloads
5266
- Memgraph in analytical workloads
53-
- Memgraph in mission critical workloads
5467
- Memgraph in supply chain use cases
5568
- Memgraph in fraud detection use cases
5669

5770
<Callout type="info">
58-
If you'd like to help us **prioritize** this content, feel free to reach out on [Discord](https://discord.gg/memgraph)!
71+
If you'd like to help us **prioritize** this content, feel free to reach out on
72+
[Discord](https://discord.gg/memgraph)!
5973
Your feedback helps us build what matters most.
6074
</Callout>
6175

pages/deployment/workloads/_meta.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export default {
22
"memgraph-in-cybersecurity": "Memgraph in cybersecurity",
33
"memgraph-in-graphrag": "Memgraph in GraphRAG use cases",
44
"memgraph-in-high-throughput-workloads": "Memgraph in high-throughput workloads",
5+
"memgraph-in-mission-critical-workloads": "Memgraph in mission critical workloads",
56
}

pages/deployment/workloads/memgraph-in-cybersecurity.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Here's why Memgraph is a great fit for cybersecurity use cases:
5050
While many graph databases **max out around 1,000 events per second**, Memgraph can handle **up to 50x more**
5151
(see image below), making it ideal for **high-velocity security event processing**.
5252

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

5555
- **Non-blocking reads and writes with MVCC**: Built on multi-version concurrency control (MVCC),
5656
Memgraph ensures that **security event ingestion doesn't block threat analysis** and **analysis doesn't block ingestion**,

pages/deployment/workloads/memgraph-in-graphrag.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Here's what makes Memgraph a perfect fit for GraphRAG:
4343
## What is covered?
4444

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

4949
- [Hardware sizing](#hardware-sizing)

pages/deployment/workloads/memgraph-in-high-throughput-workloads.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Here's why Memgraph is a great fit for high-throughput use cases:
4545
While many graph databases **max out around 1,000 writes per second**, Memgraph can handle **up to 50x more**
4646
(see image below), making it ideal for **high-velocity, write-intensive workloads**.
4747

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

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

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

7777
- [Hardware configuration](#hardware-configuration) <br />
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
---
2+
title: Memgraph in mission-critical workloads
3+
description: Suggestions on how to bring your Memgraph to production in mission-critical and high-availability workloads.
4+
---
5+
6+
import { Callout } from 'nextra/components'
7+
import { CommunityLinks } from '/components/social-card/CommunityLinks'
8+
9+
# Memgraph in mission-critical workloads
10+
11+
<Callout type="info">
12+
Before diving into this guide, we recommend starting with the [Best
13+
practices](/deployment/best-practices)
14+
15+
page. It provides **foundational, use-case-agnostic advice** for deploying
16+
Memgraph in production.
17+
18+
This guide builds on that foundation, offering **additional recommendations
19+
tailored to critical and high-availability workloads**. In cases where guidance
20+
overlaps, consider the information here as **complementary or overriding**,
21+
depending on the unique needs of your use case.
22+
</Callout>
23+
24+
## Is this guide for you?
25+
26+
This guide is for you if you're building **mission-critical systems** where
27+
uptime, data consistency, and fault tolerance are essential. You’ll benefit
28+
from this content if:
29+
30+
- You require **high availability** and **automatic failover** for your
31+
application.
32+
- You need **strong consistency guarantees** even under heavy loads.
33+
- You must **recover gracefully** from unexpected failures without data loss.
34+
- You need to **support multi-tenant environments** securely across multiple
35+
projects or customers.
36+
37+
38+
If this matches your needs, this guide will help you configure and operate
39+
Memgraph to meet the demands of **always-on production environments**.
40+
41+
## Why choose Memgraph for mission-critical use cases?
42+
43+
When stability, consistency, and resilience matter most, Memgraph is built to
44+
deliver. Here's why Memgraph is a great fit for mission-critical workloads:
45+
46+
- **In-memory storage engine with persistence** Memgraph keeps the working set
47+
fully in memory for fast access, while ensuring
48+
[durability](/fundamentals/data-durability) through **periodic snapshots** and
49+
**write-ahead logging (WALs)** in transactional mode.
50+
51+
Keeping the data in memory ensures lightning speed in times when you expect
52+
everything to function seamlessly and without issues during peak times of your
53+
critical service.
54+
55+
- **High availability with automatic failover** Memgraph supports full [high
56+
availability clustering](/clustering/high-availability), allowing you to
57+
deploy **multiple instances** with automatic **leader election** and
58+
**failover** when needed.
59+
60+
Deploying Memgraph with high availability will ensure Memgraph is up and
61+
running at all times, without compromising uptime of your services.
62+
63+
- **Multi-version concurrency control (MVCC)** Built on **MVCC**, Memgraph
64+
allows **non-blocking reads and writes**, ensuring that your system remains
65+
**responsive** even under concurrent access. Writes are not blocking reads,
66+
and vice versa.
67+
68+
- **Snapshot isolation by default** Memgraph uses **snapshot isolation** instead
69+
of **read-committed** isolation, preventing dirty reads and guaranteeing a
70+
**consistent view** of the graph at all times.
71+
72+
- **Replication for read scaling and redundancy** Memgraph supports
73+
**asynchronous replication**, enabling you to **scale read workloads**
74+
independently while ensuring **failover readiness**. For a more consistent
75+
view of the data, it also supports **synchronous replication** which
76+
prioritizes consistency over scalability.
77+
78+
- **Fine-grained access control and security** Secure your system with
79+
[**role-based access
80+
control**](/database-management/authentication-and-authorization/role-based-access-control)
81+
and [**label-based access
82+
control**](/database-management/authentication-and-authorization/role-based-access-control#label-based-access-control)
83+
to ensure only the right users see and manipulate data.
84+
85+
## What is covered?
86+
87+
The suggestions for mission-critical workloads **complement** several key
88+
sections in the [general suggestions guide](/deployment/best-practices), with
89+
additional best practices to ensure uptime and data protection:
90+
91+
- [Choosing the right Memgraph flag set](#choose-the-right-memgraph-flag-set)
92+
Memgraph offers flags to enhance recovery, snapshot management, and failover
93+
capabilities.
94+
95+
- [Choosing the right Memgraph storage
96+
mode](#choose-the-right-memgraph-storage-mode)
97+
Guidance on selecting the **safest** and **most consistent** storage
98+
configurations.
99+
100+
- [Enterprise features you might
101+
require](#enterprise-features-you-might-require)
102+
Overview of **replication**, **multi-tenancy**, and **automatic failover**
103+
tools that are critical in production.
104+
105+
- [Backup and recovery mechanisms](#backup-and-recovery-mechanisms)
106+
Best practices to protect your data through snapshots, WALs, and external
107+
backup strategies.
108+
109+
- [Queries that best suit your workload](#queries-that-best-suit-your-workload)
110+
Designing queries that maintain consistent, safe, and predictable behavior in
111+
high-availability systems.
112+
113+
## Choose the right Memgraph flag set
114+
115+
116+
For mission-critical setups, you should configure Memgraph to optimize for **durability, fast recovery**, and **stability**. Some important flags include:
117+
118+
- `--storage-snapshot-interval-sec=x`
119+
Set how often snapshots are created. In mission-critical systems, you may want
120+
**frequent snapshots** to minimize recovery time.
121+
122+
- `--storage-wal-enabled=true`
123+
Ensure **WALs (write-ahead logs)** are enabled to protect all transactions
124+
between snapshots.
125+
126+
- `--storage-parallel-schema-recovery=true` and
127+
`--storage-recovery-thread-count=x`
128+
Enable **parallel recovery** to speed up startup time after a crash by using
129+
multiple cores.
130+
131+
- `--query-execution-timeout-sec=x`
132+
Set reasonable query timeouts to **avoid stuck queries** and prevent resource
133+
exhaustion.`
134+
135+
## Choose the right Memgraph storage mode
136+
137+
138+
For mission-critical deployments:
139+
140+
- Always use `IN_MEMORY_TRANSACTIONAL` mode.
141+
- This mode provides **full ACID guarantees**, **WAL support**, and **snapshot
142+
consistency**.
143+
144+
<Callout type="info">
145+
`IN_MEMORY_ANALYTICAL` is optimized for high-speed ingestion but does **not
146+
provide transactional durability**. It is not recommended for mission-critical
147+
workloads.
148+
</Callout>
149+
150+
## Importing mechanisms
151+
152+
Importing mechanisms are best described in the [guide for high-throughput
153+
workloads](/deployment/workloads/memgraph-in-high-throughput-workloads). The
154+
rule of thumb is to always setup the drivers to perform retries if you're doing
155+
heavy amount of writes, in order to avoid read conflicts. The high throguhput
156+
guide also outlines the need for idempotent queries, to ensure data consistency
157+
if writes fail for any reason.
158+
159+
## Enterprise features you might require
160+
161+
For robust production environments, consider enabling:
162+
163+
- [High availability clustering](/clustering/high-availability): Deploy multiple
164+
Memgraph instances with automatic leader election and failover.
165+
166+
- [Replication for resilience](/clustering/replication): Distribute replicas
167+
geographically or across availability zones to minimize the risk of localized
168+
outages.
169+
170+
- [Role-based and label-based access
171+
control](/database-management/authentication-and-authorization/role-based-access-control):
172+
Protect sensitive graph data and ensure only authorized operations are
173+
performed.
174+
175+
- [Multi-tenancy](/database-management/multi-tenancy): Securely isolate data and
176+
permissions between different teams, projects, or customers.
177+
178+
## Backup and recovery mechanisms
179+
180+
Data durability is critical in mission-critical environments. Memgraph supports:
181+
182+
- [Snapshots](/fundamentals/data-durability#snapshots)
183+
Automatically or manually triggered full-database snapshots.
184+
185+
- [Write-ahead logging
186+
(WALs)](/fundamentals/data-durability#write-ahead-logging)
187+
Transaction logs that enable you to **replay changes** made after the last
188+
snapshot.
189+
190+
- **Manual backup and offloading**
191+
Use external tools (like [`rclone`](https://rclone.org/)) to back up snapshots
192+
and WALs to **cloud storage** or **remote servers** for additional redundancy.
193+
194+
195+
<Callout type="info">
196+
Memgraph currently does not automate backing up data to 3rd party locations, so
197+
integrating a backup process into your system is highly recommended.
198+
</Callout>
199+
200+
<Callout type="info">
201+
Learn more about backup and restore [on our backup and restore documentation
202+
page](/database-management/backup-and-restore).
203+
</Callout>
204+
205+
## Queries that best suit your workload
206+
207+
In mission-critical workloads:
208+
209+
- Prefer **idempotent writes** (`MERGE`) to avoid inconsistent state during
210+
retries.
211+
- Optimize long-running queries and [profile](/querying/clauses/profile) them
212+
regularly.
213+
214+
- Avoid complex, unpredictable queries inside critical transactional paths.
215+
- Use **schema constraints** and **indexes** wisely to enforce data integrity
216+
without hurting performance.
217+
218+
Example of safe, idempotent data ingestion:
219+
220+
```cypher
221+
MERGE (n:Customer {id: $id})
222+
SET n += $props;
223+
```
224+
<CommunityLinks/>

0 commit comments

Comments
 (0)