Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
c0149df
feat(redis): use replica client if in cluster
aaronArinder Jul 30, 2025
4d68cc4
fix(redis): replicas() for read commands
aaronArinder Jul 31, 2025
e005c17
squash me
aaronArinder Sep 19, 2025
eb4e1d8
Merge branch 'dev' into caroline/redis-replicas
carodewig Sep 30, 2025
c910212
fix: scheme should be checked regardless of url list length
carodewig Sep 30, 2025
c7e4c2e
chore: rely on fred's parsed config to tell if in clustered mode
carodewig Sep 30, 2025
909c0c7
refactor: simplify client access
carodewig Sep 30, 2025
cd8e1fe
chore: must flushall for retriggering 'startup' container to work
carodewig Oct 1, 2025
2ac4d7b
tmp: see if syncing cluster state manually improves performance
carodewig Oct 1, 2025
a2429ff
tmp: don't check mocks in release
carodewig Oct 1, 2025
055ea1f
Revert "tmp: don't check mocks in release"
carodewig Oct 2, 2025
9e02bd9
Revert "tmp: see if syncing cluster state manually improves performance"
carodewig Oct 2, 2025
8db018c
tmp: disable lazy connections to see fi that fixes it
carodewig Oct 2, 2025
c950c43
Merge branch 'dev' into caroline/redis-replicas
carodewig Oct 10, 2025
588b5af
refactor: fix lint
carodewig Oct 10, 2025
3adff2c
config: make lazy_replica_connections configurable for testing
carodewig Oct 10, 2025
e2fa3b3
test: refactor for linting
carodewig Oct 10, 2025
00fec67
refactor: misc test cleanup
carodewig Nov 5, 2025
4b2dae0
Merge branch 'dev' into caroline/redis-replicas
carodewig Nov 5, 2025
9bec14b
chore: mention sentinel
carodewig Nov 5, 2025
775adca
wip: save in case of crash
carodewig Nov 7, 2025
425f57c
wip
carodewig Nov 7, 2025
b304a6b
dedupe fns
carodewig Nov 10, 2025
e75380a
test: functional redis monitor
carodewig Nov 10, 2025
b5ec16f
test: fix several tests
carodewig Nov 10, 2025
3e627f5
test: remove need to specify redis_urls
carodewig Nov 10, 2025
7c660eb
test: remove duplicated test
carodewig Nov 10, 2025
25dc0c2
get compilation working
carodewig Nov 11, 2025
522fe7d
dedupe some of the repeated connection info
carodewig Nov 11, 2025
0e4cd5a
test: simplify nested access
carodewig Nov 11, 2025
2331316
test: use pointer for serde manipulation
carodewig Nov 11, 2025
91e871b
test: simplify namespace wrangling
carodewig Nov 11, 2025
eed443a
test: dedupe scan
carodewig Nov 11, 2025
112017e
test: combine modules
carodewig Nov 11, 2025
814780e
lint: fix tests
carodewig Nov 11, 2025
98382de
test: refactor and document
carodewig Nov 11, 2025
97ecc6b
test: add redis-cli to mise
carodewig Nov 11, 2025
408fbc9
refactor: use rstest for preprocess_urls tests
carodewig Nov 11, 2025
d606aba
test: only put redis-cli on the CI config
carodewig Nov 11, 2025
c2e6344
test: update config snap
carodewig Nov 11, 2025
7a94d52
test: reduce number of clients
carodewig Nov 11, 2025
26a11cb
test: sleep longer to improve test rerunnability
carodewig Nov 11, 2025
925f68b
test: always set 'required_to_start' to improve test predictability
carodewig Nov 11, 2025
0a50b2a
test: try using redis-cli 7 instead
carodewig Nov 12, 2025
8cf2be0
test: use redis rather than redis-cli for pkg isntal
carodewig Nov 12, 2025
1eba9d9
ci: remove --raw
carodewig Nov 12, 2025
7e131df
test: space out queries so make sure there's time for them to hit the…
carodewig Nov 13, 2025
0e50685
Revert "test: space out queries so make sure there's time for them to…
carodewig Nov 13, 2025
a9e72e8
test: in memory cache needs to be small
carodewig Nov 13, 2025
13a6bfc
test: send more queries, add debugging info
carodewig Nov 13, 2025
ba754f1
lint fix
carodewig Nov 13, 2025
cf942b0
test: increase sleep time
carodewig Nov 13, 2025
ef0f664
test: increase ttl so we actually get a cache hit RIP
carodewig Nov 13, 2025
c48988b
Revert "test: increase sleep time"
carodewig Nov 13, 2025
16f9699
Revert "lint fix"
carodewig Nov 13, 2025
af5b10e
Revert "test: send more queries, add debugging info"
carodewig Nov 13, 2025
7142de0
test: limit redis concurrency
carodewig Nov 13, 2025
a05e5cc
Reapply "test: increase sleep time"
carodewig Nov 14, 2025
66114eb
Reapply "test: send more queries, add debugging info"
carodewig Nov 14, 2025
97f8782
test: remove unhelpful debug
carodewig Nov 14, 2025
790a9c5
test: send queries sequentially
carodewig Nov 14, 2025
f0eb102
Merge branch 'dev' into caroline/redis-replicas
carodewig Nov 14, 2025
2a415f8
fmt: fix format
carodewig Nov 14, 2025
f3e6646
test: debug these absurd tests
carodewig Nov 14, 2025
96463c1
test: remove super inconsistent test
carodewig Nov 17, 2025
6d3defb
fix: disable lazy connections
carodewig Nov 17, 2025
edbb1a8
feat: remove lazy connections config
carodewig Nov 17, 2025
dafbe85
test: remove lazy connections from test snap
carodewig Nov 17, 2025
b81fb29
chore: prevent local mise toml
carodewig Nov 17, 2025
1b32b07
doc: better doc line for redis nextest override
carodewig Nov 17, 2025
fce3a9a
lint: misc cleanup
carodewig Nov 17, 2025
535d05d
doc: improve comments
carodewig Nov 17, 2025
fbbbd87
test: increase channel size
carodewig Nov 17, 2025
c3fedc4
Revert "test: remove super inconsistent test"
carodewig Nov 17, 2025
9fa81a1
improve comments
carodewig Nov 17, 2025
54fbe20
test: use unbounded channel rather than v large
carodewig Nov 17, 2025
79c1a0d
lint: fix fmt
carodewig Nov 17, 2025
9547318
Merge branch 'dev' into caroline/redis-replicas
carodewig Nov 17, 2025
c3a3e1b
Create feat_caroline_redis_replicas.md
carodewig Nov 17, 2025
88d81b5
test: use channel for initialization rather than sleep
carodewig Nov 18, 2025
11b4f42
doc: update DEVELOPMENT with redis-cli info
carodewig Nov 18, 2025
dc07776
test: check function of cluster, wait for containers
carodewig Nov 18, 2025
0c6d739
Merge branch 'dev' into caroline/redis-replicas
carodewig Nov 19, 2025
cb4f7c2
test: suppress mise 'keep alive' output
carodewig Nov 19, 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
8 changes: 8 additions & 0 deletions .cargo/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[test-groups]
redis = { max-threads = 6 }

[[profile.default.overrides]]
# number of tests running with 'redis' in the name should be up to 6 at any given time to prevent
# overloading the redis instances
test-group = "redis"
filter = "test(redis)"
8 changes: 8 additions & 0 deletions .changesets/feat_caroline_redis_replicas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Support Redis read replicas ([PR #8405](https://github.com/apollographql/router/pull/8405))

Read-only queries will now be sent to replica nodes when using clustered Redis. Previously, all commands would be sent
to the master nodes.

This change applies to all Redis caches, including the query plan cache and the response cache.

By [@carodewig](https://github.com/carodewig) in https://github.com/apollographql/router/pull/8405
8 changes: 2 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ commands:
command: |
curl https://mise.jdx.dev/install.sh | sh
mise activate bash >> "$BASH_ENV"
# --raw disables the terminal timer/progress bars, so if mise gets stuck,
# it will not continue to produce output preventing CCI from timing it out
mise install --yes --raw
Comment thread
bnjjj marked this conversation as resolved.
mise install --yes --quiet
- when:
condition:
or:
Expand All @@ -271,9 +269,7 @@ commands:
name: Install mise
command: |
scoop install mise@${MISE_VERSION#v}
# --raw disables the terminal timer/progress bars, so if mise gets stuck,
# it will not continue to produce output preventing CCI from timing it out
mise install --yes --raw
mise install --yes --quiet
fetch_dependencies:
steps:
- run:
Expand Down
1 change: 1 addition & 0 deletions .config/mise/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ helm = "3.19.2"
helm-docs = "1.14.2"
yq = "4.48.2"
jq = "1.8.1"
redis = "7.4.7"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ dhat-heap.json
# generated fuzz/ files
fuzz/crash-*
fuzz/slow-unit-*
fuzz/timeout-*
fuzz/timeout-*

.config/mise/mise.local.toml
10 changes: 6 additions & 4 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The **Apollo Router Core** is a configurable, high-performance **graph router**

## Development

We use [`mise`](https://mise.jdx.dev/) to manage toolchain dependencies.
We use [`mise`](https://mise.jdx.dev/) to manage toolchain and test dependencies.
Example commands in this document assume that mise shims are available in the environment.
If you do not use `mise activate`, you can use `mise x -- <COMMAND>` in place of the commands below, for example `mise x -- cargo build`.

Expand All @@ -28,15 +28,16 @@ docker compose up -d
```

This starts:
- **Redis** (port 6379-7005) - Required for entity caching, response caching, and Redis-related integration tests
- **PostgreSQL** (port 5432) - Used by database integration tests
- **Redis** (port 6379, 7000-7005) - Required for entity caching, response caching, and Redis-related integration tests
- **Zipkin** (port 9411) - For distributed tracing tests
- **Datadog Agent** (port 8126) - For Datadog telemetry integration tests

Some tests that use the features above are configured with `required_to_start: true`. The router won't start if these services aren't available, causing test failures.

**Note:** `-d` runs services in the background. Remove `-d` if you want to see logs or run in foreground.

Several tests also require the `redis-cli` binary; this is installed by default if you use `mise`.

#### Enterprise feature testing

Some tests require Apollo GraphOS credentials to test enterprise features like licensing, reporting, and Apollo Studio integration.
Expand All @@ -53,7 +54,8 @@ export TEST_APOLLO_GRAPH_REF="your-graph-ref@variant"

### Testing

Tests on this repository are run using [nextest](https://nexte.st/). nextest is installed automatically when you use `mise`.
Tests on this repository are run using [nextest](https://nexte.st/). nextest is installed automatically when you use
`mise`.

#### Test environment setup

Expand Down
2 changes: 2 additions & 0 deletions apollo-router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ fred = { version = "10.1.0", features = [
"i-cluster",
"tcp-user-timeouts",
"metrics",
"replicas",
"serde-json"
] }
futures = { version = "0.3.30", features = ["thread-pool"] }
Expand Down Expand Up @@ -310,6 +311,7 @@ fred = { version = "10.1.0", features = [
"mocks",
"i-cluster",
"tcp-user-timeouts",
"replicas"
] }
futures-test = "0.3.30"
insta.workspace = true
Expand Down
Loading