Skip to content

Commit 3315b22

Browse files
committed
chore: performance benchmarks project
Add a subproject to run perf. comparison against other checkpointers and make improvements.
1 parent 8e87eba commit 3315b22

File tree

7 files changed

+4623
-0
lines changed

7 files changed

+4623
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,4 @@ libs/redis/docs/.Trash*
222222
.idea/*
223223
examples/.Trash*
224224
.claude
225+
/benchmarks/reports/*

benchmarks/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.PHONY: help install benchmark plots clean all
2+
3+
help:
4+
@echo "LangGraph Redis Checkpointer Benchmarks"
5+
@echo ""
6+
@echo "Available targets:"
7+
@echo " install - Install benchmark dependencies"
8+
@echo " benchmark - Run comprehensive checkpointer benchmark"
9+
@echo " plots - Generate performance plots from results"
10+
@echo " all - Run benchmark and generate plots"
11+
@echo " clean - Remove generated reports and plots"
12+
@echo ""
13+
@echo "Prerequisites:"
14+
@echo " - Docker (for TestContainers)"
15+
@echo " - Optional: Redis Stack for local Redis testing"
16+
17+
install:
18+
poetry install
19+
20+
benchmark:
21+
@echo "🚀 Running comprehensive checkpointer benchmark..."
22+
poetry run python checkpointer_benchmark.py
23+
24+
plots:
25+
@echo "📊 Generating performance plots..."
26+
poetry run python create_plots.py
27+
28+
all: benchmark plots
29+
@echo "✅ Benchmark and plots completed"
30+
31+
clean:
32+
@echo "🧹 Cleaning up reports and plots..."
33+
rm -rf reports/
34+
rm -f *.png *.jpg *.svg

benchmarks/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# LangGraph Redis Checkpointer Benchmarks
2+
3+
Performance benchmarks comparing Redis checkpointer implementations against all other official LangGraph checkpointers.
4+
5+
## What It Tests
6+
7+
The `checkpointer_benchmark.py` benchmarks:
8+
9+
- **Selected LangGraph checkpointers**: Memory, SQLite, MongoDB, MySQL (regular and shallow), Redis (regular and shallow)
10+
- **Workload patterns**: Fanout-to-subgraph pattern with parallel executions
11+
- **Scaling behavior**: Tests from 100 to 900 parallel executions
12+
- **Individual operations**: Put, get, list checkpoints, and writes operations
13+
14+
## Quick Start
15+
16+
```bash
17+
# Install dependencies
18+
make install
19+
20+
# Run benchmark and generate plots
21+
make all
22+
```
23+
24+
## Prerequisites
25+
26+
- **Docker** (required for TestContainers)
27+
28+
The benchmark uses TestContainers to automatically spin up database instances as needed. No manual database setup required.
29+
30+
## Commands
31+
32+
```bash
33+
make benchmark # Run performance tests
34+
make plots # Generate charts from results
35+
make clean # Remove reports and plots
36+
```
37+
38+
## Results
39+
40+
Results are saved to `reports/` directory:
41+
42+
- `run-TIMESTAMP/` - Individual JSON reports per checkpointer
43+
- `summary_TIMESTAMP.json` - Comparative summary
44+
- Performance plots (PNG files) showing scaling behavior
45+
46+
## Checkpointer Coverage
47+
48+
**Regular implementations tested:**
49+
- Memory (reference)
50+
- SQLite
51+
- MongoDB
52+
- MySQL
53+
- Redis
54+
55+
**Shallow implementations tested:**
56+
- MySQL (shallow)
57+
- Redis (shallow)
58+
59+
Note: SQLite and MongoDB do not have shallow variants available and Postgres shallow impl. is broken
60+

0 commit comments

Comments
 (0)