Skip to content

Commit 72b08fa

Browse files
carodewigaembke
andauthored
Add timeouts and connection health checks to Redis connections (#7526)
Co-authored-by: Alec Embke <[email protected]>
1 parent 814b356 commit 72b08fa

File tree

8 files changed

+151
-144
lines changed

8 files changed

+151
-144
lines changed

.changesets/maint_caroline_redis.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
### Add timeouts and connection health checks to Redis connections ([Issue #6855](https://github.com/apollographql/router/issues/6855))
2+
3+
This PR updates the internal Redis configuration to improve client resiliency under various failure modes (TCP failures
4+
and timeouts, unresponsive sockets, Redis server failures, etc.). It also adds heartbeats (a PING every 10 seconds) to the Redis clients.
5+
6+
By [@aembke](https://github.com/aembke), [@carodewig](https://github.com/carodewig) in https://github.com/apollographql/router/pull/7526

Cargo.lock

Lines changed: 25 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ dependencies = [
372372
"rstest",
373373
"rust-embed",
374374
"rustls",
375-
"rustls-native-certs 0.8.1",
375+
"rustls-native-certs",
376376
"rustls-pemfile",
377377
"ryu",
378378
"schemars",
@@ -972,7 +972,7 @@ dependencies = [
972972
"hyper-util",
973973
"pin-project-lite",
974974
"rustls",
975-
"rustls-native-certs 0.8.1",
975+
"rustls-native-certs",
976976
"rustls-pki-types",
977977
"tokio",
978978
"tower 0.5.2",
@@ -1731,16 +1731,6 @@ dependencies = [
17311731
"tower 0.5.2",
17321732
]
17331733

1734-
[[package]]
1735-
name = "core-foundation"
1736-
version = "0.9.4"
1737-
source = "registry+https://github.com/rust-lang/crates.io-index"
1738-
checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
1739-
dependencies = [
1740-
"core-foundation-sys",
1741-
"libc",
1742-
]
1743-
17441734
[[package]]
17451735
name = "core-foundation"
17461736
version = "0.10.0"
@@ -1856,15 +1846,6 @@ dependencies = [
18561846
"crossbeam-utils",
18571847
]
18581848

1859-
[[package]]
1860-
name = "crossbeam-queue"
1861-
version = "0.3.11"
1862-
source = "registry+https://github.com/rust-lang/crates.io-index"
1863-
checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35"
1864-
dependencies = [
1865-
"crossbeam-utils",
1866-
]
1867-
18681849
[[package]]
18691850
name = "crossbeam-utils"
18701851
version = "0.8.20"
@@ -2409,9 +2390,9 @@ dependencies = [
24092390

24102391
[[package]]
24112392
name = "float-cmp"
2412-
version = "0.9.0"
2393+
version = "0.10.0"
24132394
source = "registry+https://github.com/rust-lang/crates.io-index"
2414-
checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4"
2395+
checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8"
24152396
dependencies = [
24162397
"num-traits",
24172398
]
@@ -2508,24 +2489,24 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa"
25082489

25092490
[[package]]
25102491
name = "fred"
2511-
version = "9.4.0"
2492+
version = "10.1.0"
25122493
source = "registry+https://github.com/rust-lang/crates.io-index"
2513-
checksum = "3cdd5378252ea124b712e0ac55147d26ae3af575883b34b8423091a4c719606b"
2494+
checksum = "3a7b2fd0f08b23315c13b6156f971aeedb6f75fb16a29ac1872d2eabccc1490e"
25142495
dependencies = [
25152496
"arc-swap",
25162497
"async-trait",
25172498
"bytes",
25182499
"bytes-utils",
2519-
"crossbeam-queue",
25202500
"float-cmp",
25212501
"fred-macros",
25222502
"futures",
2503+
"glob-match",
25232504
"log",
25242505
"parking_lot",
25252506
"rand 0.8.5",
25262507
"redis-protocol",
25272508
"rustls",
2528-
"rustls-native-certs 0.7.3",
2509+
"rustls-native-certs",
25292510
"semver",
25302511
"socket2",
25312512
"tokio",
@@ -2763,6 +2744,12 @@ version = "0.3.1"
27632744
source = "registry+https://github.com/rust-lang/crates.io-index"
27642745
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
27652746

2747+
[[package]]
2748+
name = "glob-match"
2749+
version = "0.2.1"
2750+
source = "registry+https://github.com/rust-lang/crates.io-index"
2751+
checksum = "9985c9503b412198aa4197559e9a318524ebc4519c229bfa05a535828c950b9d"
2752+
27662753
[[package]]
27672754
name = "globset"
27682755
version = "0.4.15"
@@ -3202,7 +3189,7 @@ dependencies = [
32023189
"hyper",
32033190
"hyper-util",
32043191
"rustls",
3205-
"rustls-native-certs 0.8.1",
3192+
"rustls-native-certs",
32063193
"rustls-pki-types",
32073194
"tokio",
32083195
"tokio-rustls",
@@ -4891,8 +4878,8 @@ version = "0.13.4"
48914878
source = "registry+https://github.com/rust-lang/crates.io-index"
48924879
checksum = "d0f3e5beed80eb580c68e2c600937ac2c4eedabdfd5ef1e5b7ea4f3fba84497b"
48934880
dependencies = [
4894-
"heck 0.4.1",
4895-
"itertools 0.11.0",
4881+
"heck 0.5.0",
4882+
"itertools 0.13.0",
48964883
"log",
48974884
"multimap 0.10.1",
48984885
"once_cell",
@@ -5096,9 +5083,9 @@ dependencies = [
50965083

50975084
[[package]]
50985085
name = "redis-protocol"
5099-
version = "5.0.1"
5086+
version = "6.0.0"
51005087
source = "registry+https://github.com/rust-lang/crates.io-index"
5101-
checksum = "65deb7c9501fbb2b6f812a30d59c0253779480853545153a51d8e9e444ddc99f"
5088+
checksum = "9cdba59219406899220fc4cdfd17a95191ba9c9afb719b5fa5a083d63109a9f1"
51025089
dependencies = [
51035090
"bytes",
51045091
"bytes-utils",
@@ -5212,7 +5199,7 @@ dependencies = [
52125199
"pin-project-lite",
52135200
"quinn",
52145201
"rustls",
5215-
"rustls-native-certs 0.8.1",
5202+
"rustls-native-certs",
52165203
"rustls-pemfile",
52175204
"rustls-pki-types",
52185205
"serde",
@@ -5563,19 +5550,6 @@ dependencies = [
55635550
"zeroize",
55645551
]
55655552

5566-
[[package]]
5567-
name = "rustls-native-certs"
5568-
version = "0.7.3"
5569-
source = "registry+https://github.com/rust-lang/crates.io-index"
5570-
checksum = "e5bfb394eeed242e909609f56089eecfe5fda225042e8b171791b9c95f5931e5"
5571-
dependencies = [
5572-
"openssl-probe",
5573-
"rustls-pemfile",
5574-
"rustls-pki-types",
5575-
"schannel",
5576-
"security-framework 2.11.1",
5577-
]
5578-
55795553
[[package]]
55805554
name = "rustls-native-certs"
55815555
version = "0.8.1"
@@ -5585,7 +5559,7 @@ dependencies = [
55855559
"openssl-probe",
55865560
"rustls-pki-types",
55875561
"schannel",
5588-
"security-framework 3.0.1",
5562+
"security-framework",
55895563
]
55905564

55915565
[[package]]
@@ -5698,27 +5672,14 @@ dependencies = [
56985672
"zeroize",
56995673
]
57005674

5701-
[[package]]
5702-
name = "security-framework"
5703-
version = "2.11.1"
5704-
source = "registry+https://github.com/rust-lang/crates.io-index"
5705-
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
5706-
dependencies = [
5707-
"bitflags 2.6.0",
5708-
"core-foundation 0.9.4",
5709-
"core-foundation-sys",
5710-
"libc",
5711-
"security-framework-sys",
5712-
]
5713-
57145675
[[package]]
57155676
name = "security-framework"
57165677
version = "3.0.1"
57175678
source = "registry+https://github.com/rust-lang/crates.io-index"
57185679
checksum = "e1415a607e92bec364ea2cf9264646dcce0f91e6d65281bd6f2819cca3bf39c8"
57195680
dependencies = [
57205681
"bitflags 2.6.0",
5721-
"core-foundation 0.10.0",
5682+
"core-foundation",
57225683
"core-foundation-sys",
57235684
"libc",
57245685
"security-framework-sys",
@@ -6477,7 +6438,7 @@ dependencies = [
64776438
"futures-util",
64786439
"log",
64796440
"rustls",
6480-
"rustls-native-certs 0.8.1",
6441+
"rustls-native-certs",
64816442
"rustls-pki-types",
64826443
"tokio",
64836444
"tokio-rustls",
@@ -6538,7 +6499,7 @@ dependencies = [
65386499
"percent-encoding",
65396500
"pin-project",
65406501
"prost",
6541-
"rustls-native-certs 0.8.1",
6502+
"rustls-native-certs",
65426503
"rustls-pemfile",
65436504
"socket2",
65446505
"tokio",
@@ -7227,7 +7188,7 @@ version = "0.1.9"
72277188
source = "registry+https://github.com/rust-lang/crates.io-index"
72287189
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
72297190
dependencies = [
7230-
"windows-sys 0.48.0",
7191+
"windows-sys 0.59.0",
72317192
]
72327193

72337194
[[package]]

apollo-router/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ dhat = { version = "0.3.3", optional = true }
9292
diff = "0.1.13"
9393
displaydoc = "0.2"
9494
flate2 = "1.0.30"
95-
fred = { version = "9.4.0", features = ["enable-rustls-ring", "i-cluster"] }
95+
fred = { version = "10.1.0", features = ["enable-rustls-ring", "i-cluster", "tcp-user-timeouts"] }
9696
futures = { version = "0.3.30", features = ["thread-pool"] }
9797
graphql_client = "0.14.0"
9898
hex.workspace = true
@@ -280,7 +280,7 @@ tikv-jemallocator = "0.6.0"
280280
axum = { version = "0.8.1", features = ["http2", "ws"] }
281281
axum-server = "0.7.1"
282282
ecdsa = { version = "0.16.9", features = ["signing", "pem", "pkcs8"] }
283-
fred = { version = "9.4.0", features = ["enable-rustls-ring", "mocks", "i-cluster"] }
283+
fred = { version = "10.1.0", features = ["enable-rustls-ring", "mocks", "i-cluster", "tcp-user-timeouts"] }
284284
futures-test = "0.3.30"
285285
insta.workspace = true
286286
maplit = "1.0.2"

0 commit comments

Comments
 (0)