diff --git a/.changesets/config_geal_raise_redis_timeouts.md b/.changesets/config_geal_raise_redis_timeouts.md new file mode 100644 index 0000000000..3dec9af696 --- /dev/null +++ b/.changesets/config_geal_raise_redis_timeouts.md @@ -0,0 +1,5 @@ +### Increase default Redis timeout ([PR #5795](https://github.com/apollographql/router/pull/5795)) + +The default Redis command timeout was increased from 2ms to 500ms to accommodate common production use cases. + +By [@Geal](https://github.com/Geal) in https://github.com/apollographql/router/pull/5795 \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 7c5fe5a189..2d5abeb92d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,4 +75,4 @@ serde_json_bytes = { version = "0.2.4", features = ["preserve_order"] } sha1 = "0.10.6" tempfile = "3.10.1" tokio = { version = "1.36.0", features = ["full"] } -tower = { version = "0.4.13", features = ["full"] } +tower = { version = "0.4.13", features = ["full"] } \ No newline at end of file diff --git a/apollo-router/src/cache/redis.rs b/apollo-router/src/cache/redis.rs index ae0697b3cf..1e14cc4247 100644 --- a/apollo-router/src/cache/redis.rs +++ b/apollo-router/src/cache/redis.rs @@ -171,7 +171,7 @@ impl RedisCacheStorage { let client = RedisClient::new( client_config, Some(PerformanceConfig { - default_command_timeout: config.timeout.unwrap_or(Duration::from_millis(2)), + default_command_timeout: config.timeout.unwrap_or(Duration::from_millis(500)), ..Default::default() }), None, diff --git a/docs/source/configuration/distributed-caching.mdx b/docs/source/configuration/distributed-caching.mdx index 2890cad126..ddc87a6fa3 100644 --- a/docs/source/configuration/distributed-caching.mdx +++ b/docs/source/configuration/distributed-caching.mdx @@ -131,7 +131,7 @@ supergraph: urls: ["redis://..."] #highlight-line username: admin/123 # Optional, can be part of the urls directly, mainly useful if you have special character like '/' in your password that doesn't work in url. This field takes precedence over the username in the URL password: admin # Optional, can be part of the urls directly, mainly useful if you have special character like '/' in your password that doesn't work in url. This field takes precedence over the password in the URL - timeout: 5ms # Optional, by default: 2ms + timeout: 2s # Optional, by default: 500ms ttl: 24h # Optional namespace: "prefix" # Optional #tls: @@ -141,7 +141,7 @@ supergraph: #### Timeout -Connecting and sending commands to Redis are subject to a timeout, set by default to 2ms, that can be overriden. +Connecting and sending commands to Redis are subject to a timeout, set by default to 500ms, that can be overriden. #### TTL diff --git a/docs/source/configuration/entity-caching.mdx b/docs/source/configuration/entity-caching.mdx index 6d53a2ba7b..a44cbd806d 100644 --- a/docs/source/configuration/entity-caching.mdx +++ b/docs/source/configuration/entity-caching.mdx @@ -91,7 +91,7 @@ preview_entity_cache: # Configure Redis redis: urls: ["redis://..."] - timeout: 5ms # Optional, by default: 2ms + timeout: 2s # Optional, by default: 500ms ttl: 24h # Optional, by default no expiration # Configure entity caching per subgraph, overrides options from the "all" section subgraphs: