Skip to content

Commit 2817738

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/azure-docs-pr into patricka-freshness
2 parents 166b24f + 8bf0406 commit 2817738

File tree

8 files changed

+175
-177
lines changed

8 files changed

+175
-177
lines changed
Lines changed: 73 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,54 @@
11
---
2-
title: Best practices using client libraries
3-
description: Learn about client libraries for Azure Cache for Redis.
2+
title: Best practices for client libraries
3+
description: Learn about recommended client libraries for Azure Cache for Redis, including a section devoted to Redisson best practices.
44

55

66
ms.topic: conceptual
7-
ms.date: 02/06/2025
7+
ms.date: 05/05/2025
88
appliesto:
99
- ✅ Azure Cache for Redis
1010
ms.custom: devx-track-java, devx-track-javaee, devx-track-javaee-liberty, devx-track-javaee-liberty-aks, devx-track-extended-java, ignite-2024
1111
---
1212

1313
# Client libraries
1414

15-
Azure Cache for Redis is based on the popular open-source in-memory data store, open-source Redis. Redis clients for many programming languages can access Azure Managed Redis. Each client library has its own API that makes calls to Redis server using Redis commands, but the client libraries are built to talk to any Redis server.
15+
Azure Cache for Redis is based on the Redis open-source, in-memory data store. Redis clients for many programming languages can access Azure Redis. Your application can use any client library that's compatible with open-source Redis to connect to your Azure Redis cache.
1616

17-
Each client maintains its own reference documentation for its library. The clients also provide links to get support through the client library developer community. The Azure Cache for Redis team doesn't own the development, or the support for any client libraries.
17+
Each client library has its own API that calls Redis servers using Redis commands. The client libraries are built to communicate with any Redis server.
1818

19-
Although we don't own or support any client libraries, we do recommend some libraries. Recommendations are based on popularity and whether there's an active online community to support and answer your questions. We only recommend using the latest available version, and upgrading regularly as new versions become available. These libraries are under active development and often release new versions with improvements to reliability and performance.
19+
Clients maintain reference documentation for their own libraries, and provide links to get support through the client library developer community. Microsoft and the Azure Redis team don't own the development or support for any client libraries.
2020

21-
| **Client library** | **Language** | **GitHub** **repo** | **Documentation**|
21+
Microsoft and Azure Redis do recommend some libraries, based on popularity and whether there's an active online support community to answer questions. These libraries are under active development and often release new versions with reliability and performance improvements. Microsoft recommends using the latest available version, and upgrading regularly as new versions become available.
22+
23+
The following table lists links and documentation for some recommended client libraries.
24+
25+
| **Client library** | **Language** | **GitHub repo** | **Documentation**|
2226
| --------------------|------------- |-------------------------------------------------------| --------------------------|
23-
| StackExchange.Redis | C#/.NET | [Link](https://github.com/StackExchange/StackExchange.Redis)| [More information here](https://stackexchange.github.io/StackExchange.Redis/) |
24-
| Lettuce | Java | [Link](https://github.com/lettuce-io/) | [More information here](https://lettuce.io/) |
25-
| Jedis | Java | [Link](https://github.com/redis/jedis) | |
26-
| node_redis | Node.js | [Link](https://github.com/redis/node-redis) | |
27-
| Redisson | Java | [Link](https://github.com/redisson/redisson) | [More information here](https://redisson.org/) |
28-
| ioredis | Node.js | [Link](https://github.com/luin/ioredis) | [More information here](https://ioredis.readthedocs.io/en/stable/API/) |
27+
| StackExchange.Redis | C#/.NET | [https://github.com/StackExchange/StackExchange.Redis](https://github.com/StackExchange/StackExchange.Redis)| [StackExchange.Redis](https://stackexchange.github.io/StackExchange.Redis/) |
28+
| Jedis | Java | [https://github.com/redis/jedis](https://github.com/redis/jedis) | |
29+
| Lettuce | Java | [https://github.com/lettuce-io/](https://github.com/lettuce-io/) | [Lettuce - Advanced Java Redis client](https://lettuce.io/) |
30+
| Redisson | Java | [https://github.com/redisson/redisson](https://github.com/redisson/redisson) | [Redisson - Redis Java client Real-Time Data Platform](https://redisson.pro/docs/) |
31+
| ioredis | Node.js | [https://github.com/luin/ioredis](https://github.com/luin/ioredis) | [Classes](https://ioredis.readthedocs.io/en/stable/API/) |
32+
| node_redis | Node.js | [https://github.com/redis/node-redis](https://github.com/redis/node-redis) | |
2933

3034
> [!NOTE]
31-
> Your application can use any client library that is compatible with open-source Redis to connect to your Azure Cache for Redis instance.
35+
> Your application can use any client library that's compatible with open-source Redis to connect to your Azure Redis instance.
3236
3337
## Client library-specific guidance
3438

35-
For information on client library-specific guidance best practices, see the following links:
39+
For client library-specific guidance and best practices, see the following links:
3640

3741
- [StackExchange.Redis (.NET)](cache-best-practices-connection.md#using-forcereconnect-with-stackexchangeredis)
38-
- [Lettuce (Java)](https://github.com/Azure/AzureCacheForRedis/blob/main/Lettuce%20Best%20Practices.md)
42+
- [HiRedisCluster](https://github.com/Azure/AzureCacheForRedis/blob/main/HiRedisCluster%20Best%20Practices.md)
3943
- [Jedis (Java)](https://github.com/Azure/AzureCacheForRedis/blob/main/Redis-BestPractices-Java-Jedis.md)
40-
- [Redisson (Java)](cache-best-practices-client-libraries.md#redisson-java)
44+
- [Lettuce (Java)](https://github.com/Azure/AzureCacheForRedis/blob/main/Lettuce%20Best%20Practices.md)
4145
- [Node.js](https://github.com/Azure/AzureCacheForRedis/blob/main/Redis-BestPractices-Node-js.md)
4246
- [PHP](https://github.com/Azure/AzureCacheForRedis/blob/main/Redis-BestPractices-PHP.md)
43-
- [HiRedisCluster](https://github.com/Azure/AzureCacheForRedis/blob/main/HiRedisCluster%20Best%20Practices.md)
44-
45-
## Redisson (Java)
46-
47-
We _recommend_ you use redisson 3.14.1 or higher. Older versions contain known connection leak issues that cause problems after failovers. Monitor the Redisson changelog for other known issues can affect features used by your application. For more information, see[`CHANGELOG`](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) and the [Redisson FAQ](https://github.com/redisson/redisson/wiki/16.-FAQ).
48-
49-
Other notes:
50-
51-
- Redisson defaults to 'read from replica' strategy, unlike some other clients. To change this default, modify the 'readMode' config setting.
52-
- Redisson has a connection pooling strategy with configurable minimum and maximum settings, and the default minimum values are large. The large defaults could contribute to aggressive reconnect behaviors or 'connection storms.' To reduce the risk, consider using fewer connections because you can efficiently pipeline commands, or batches of commands, over a few connections.
53-
- Redisson has a default idle connection time out of 10 seconds, which leads to more closing and reopening of connections than ideal.
54-
55-
Here's a recommended baseline configuration for cluster mode that you can modify as needed:
56-
57-
```yml
58-
clusterServersConfig:
59-
idleConnectionTimeout: 30000
60-
connectTimeout: 15000
61-
timeout: 5000
62-
retryAttempts: 3
63-
retryInterval: 3000
64-
checkLockSyncedSlaves: false
65-
failedSlaveReconnectionInterval: 15000
66-
failedSlaveCheckInterval: 60000
67-
subscriptionsPerConnection: 5
68-
clientName: "redisson"
69-
loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
70-
subscriptionConnectionMinimumIdleSize: 1
71-
subscriptionConnectionPoolSize: 50
72-
slaveConnectionMinimumIdleSize: 2
73-
slaveConnectionPoolSize: 24
74-
masterConnectionMinimumIdleSize: 2
75-
masterConnectionPoolSize: 24
76-
readMode: "MASTER"
77-
subscriptionMode: "MASTER"
78-
nodeAddresses:
79-
- "redis://mycacheaddress:6380"
80-
scanInterval: 1000
81-
pingConnectionInterval: 60000
82-
keepAlive: false
83-
tcpNoDelay: true
84-
```
85-
86-
For an article about Redisson's support for JCache as the store for HTTP session state in IBM Liberty on Azure, see [Use Java EE JCache with Open Liberty or WebSphere Liberty on an Azure Kubernetes Service (AKS) cluster](/azure/developer/java/ee/how-to-deploy-java-liberty-jcache).
47+
- [Redisson (Java)](cache-best-practices-client-libraries.md#best-practices-for-redisson-java)
8748

8849
## How to use client libraries
8950

90-
Besides the reference documentation, you can find tutorials showing how to get started with Azure Cache for Redis using different languages and cache clients.
91-
92-
For more information on using some of these client libraries in tutorials, see the following articles:
51+
Besides the reference documentation, you can use the following tutorials to get started with Azure Redis using different languages and cache clients:
9352

9453
- [Code a .NET Framework app](../redis/dotnet-how-to-use-azure-redis-cache.md)
9554
- [Code a .NET Core app](../redis/dotnet-core-quickstart.md)
@@ -99,7 +58,56 @@ For more information on using some of these client libraries in tutorials, see
9958
- [Code a Node.js app](../redis/nodejs-get-started.md)
10059
- [Code a Python app](../redis/python-get-started.md)
10160

102-
## Next steps
61+
## Best practices for Redisson (Java)
62+
63+
Here are some recommended best practices for the [Redisson](https://redisson.pro/) client library:
64+
65+
- Use Redisson 3.14.1 or higher. Older versions contain known connection leak issues that cause problems after failovers.
66+
67+
- Monitor the Redisson changelog for known issues that can affect features your application uses. For more information, see the [Redisson Releases History](https://github.com/redisson/redisson/blob/master/CHANGELOG.md) and the [Redisson FAQ](https://redisson.pro/docs/faq/).
68+
69+
- Modify the `readMode` config setting if you don't want to use the *read from replica* strategy. Unlike some other clients, Redisson uses *read from replica* as the default.
70+
71+
- To reduce the risk of aggressive reconnect behaviors or *connection storms*, consider setting fewer minimum connections.
72+
73+
Redisson has a connection pooling strategy with configurable minimum and maximum settings, and the default minimum values are large. The large defaults could contribute to aggressive reconnect behaviors or connection storms. To reduce this risk, consider using fewer connections. You can efficiently pipeline commands or batches of commands over a few connections.
74+
75+
- Reset the idle connection timeout if necessary. Redisson has a default 10-second idle connection timeout, which can lead to more closing and reopening of connections than ideal.
76+
77+
- For information about using Redisson with Java EE JCache to store HTTP session state on an Azure Kubernetes Service (AKS) cluster, see [Using Azure Redis as session cache for WebSphere Liberty or Open Liberty](/azure/developer/java/ee/how-to-deploy-java-liberty-jcache).
78+
79+
- Use the following recommended baseline configuration for cluster mode, and modify it as needed.
80+
81+
```yml
82+
clusterServersConfig:
83+
idleConnectionTimeout: 30000
84+
connectTimeout: 15000
85+
timeout: 5000
86+
retryAttempts: 3
87+
retryInterval: 3000
88+
checkLockSyncedSlaves: false
89+
failedSlaveReconnectionInterval: 15000
90+
failedSlaveCheckInterval: 60000
91+
subscriptionsPerConnection: 5
92+
clientName: "redisson"
93+
loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
94+
subscriptionConnectionMinimumIdleSize: 1
95+
subscriptionConnectionPoolSize: 50
96+
slaveConnectionMinimumIdleSize: 2
97+
slaveConnectionPoolSize: 24
98+
masterConnectionMinimumIdleSize: 2
99+
masterConnectionPoolSize: 24
100+
readMode: "MASTER"
101+
subscriptionMode: "MASTER"
102+
nodeAddresses:
103+
- "redis://mycacheaddress:6380"
104+
scanInterval: 1000
105+
pingConnectionInterval: 60000
106+
keepAlive: false
107+
tcpNoDelay: true
108+
```
109+
110+
## Related content
103111
104112
- [Azure Cache for Redis development FAQs](cache-development-faq.yml)
105113
- [Best practices for development](cache-best-practices-development.md)

0 commit comments

Comments
 (0)