Skip to content

Commit bad6686

Browse files
committed
Lettuce: Improve guidelines on timeouts
Document that Netty Native transports should be installed in order to set TCP-level timeouts.
1 parent 565bdf7 commit bad6686

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

content/develop/clients/lettuce/produsage.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ In some cases, the defaults are based on environment-specific settings (e.g., op
2929
For more details on setting specific timeouts, see the [Lettuce reference guide](https://redis.github.io/lettuce/).
3030
{{% /alert %}}
3131

32+
### Prerequisites
33+
34+
To set TCP-level timeouts, you need to ensure you have one of [Netty Native Transports](https://netty.io/wiki/native-transports.html) installed. The most common one is `netty-transport-native-epoll`, which is used for Linux systems. You can add it to your project by including the following dependency in your `pom.xml` file:
35+
36+
```xml
37+
<dependency>
38+
<groupId>io.netty</groupId>
39+
<artifactId>netty-transport-native-epoll</artifactId>
40+
<version>${netty.version}</version> <!-- e.g., 4.1.118.Final -->
41+
<classifier>linux-x86_64</classifier>
42+
</dependency>
43+
```
44+
45+
Once you have the native transport dependency, you can verify that by using the following code:
46+
47+
```java
48+
logger.info("Lettuce epool is available: {}", EpollProvider.isAvailable());
49+
```
50+
51+
If the snippet above returns `false`, you need to enable debugging logging for `io.lettuce.core` and `io.netty` to see why the native transport is not available.
52+
53+
For more information on using Netty Native Transport, see the [Lettuce reference guide](https://redis.github.io/lettuce/advanced-usage/#native-transports).
54+
55+
### Setting timeouts
56+
3257
Below is an example of setting socket-level timeouts. The `TCP_USER_TIMEOUT` setting is useful for scenarios where the server stops responding without acknowledging the last request, while the `KEEPALIVE` setting is good for detecting dead connections where there is no traffic between the client and the server.
3358

3459
```java

0 commit comments

Comments
 (0)