Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changesets/fix_low_redis_timeout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Update internal redis timeout ([PR #8863](https://github.com/apollographql/router/pull/8863))
Because mTLS handshakes can be slow in some environments, we’ve doubled our internal Redis timeout from 5s to 10s. This also increases the connection "unresponsive" threshold from 5s to 10s.


By [@aaronarinder](https://github.com/aaronarinder) in https://github.com/apollographql/router/pull/8863
6 changes: 5 additions & 1 deletion apollo-router/src/cache/redis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const SUPPORTED_REDIS_SCHEMES: [&str; 6] = [
];

/// Timeout applied to internal Redis operations, such as TCP connection initialization, TLS handshakes, AUTH or HELLO, cluster health checks, etc.
const DEFAULT_INTERNAL_REDIS_TIMEOUT: Duration = Duration::from_secs(5);
// NOTE: In practice we've found that 5s is too low, so we've set it to 10s. Do some sanity checking before tweaking it to a lower value
const DEFAULT_INTERNAL_REDIS_TIMEOUT: Duration = Duration::from_secs(10);
/// Interval on which we send PING commands to the Redis servers.
const REDIS_HEARTBEAT_INTERVAL: Duration = Duration::from_secs(10);

Expand Down Expand Up @@ -362,6 +363,9 @@ impl RedisCacheStorage {
}
})
.with_connection_config(|config| {
// NOTE: the default internal_command_timeout is 10s, so this line is just to make
// it explicit that we're using that default (at the time of writing, this const is
// set to 10s)
config.internal_command_timeout = DEFAULT_INTERNAL_REDIS_TIMEOUT;
config.max_command_buffer_len = 10_000;
config.reconnect_on_auth_error = true;
Expand Down