DCS Redis Help Documentation

What Clients Can I Use for Redis Clusters in Different Programming Languages?

2024-05-25 03:38:39

The following table compares DCS Cluster and Proxy Cluster.

Table 1 Comparing Redis Cluster and Proxy Cluster

Comparison Items

Cluster

Proxy cluster

Native compatibility

High

Medium

Client compatibility

Medium

High

Cost performance

High

Medium

Latency

Small latency

Medium latency

Performance

High

Medium

Redis Cluster does not use proxies, and therefore delivers lower latency and higher performance. However, Redis Cluster instances are based on the open-source Redis Cluster protocol, so their client compatibility is poorer than that of Proxy Cluster instances.

The following table lists clients that can be used for Redis Cluster.

List of recommended open-source clients: https://redis.io/clients.

Table 2 Clients that can be used for Redis Cluster

Language

Client

Reference Document

Java

Jedis

https://github.com/xetorthio/jedis#jedis-cluster

Java

Lettuce

https://github.com/lettuce-io/lettuce-core/wiki/Redis-Cluster

PHP

php redis

https://github.com/phpredis/phpredis#readme

Go

Go Redis

Cluster: https://pkg.go.dev/github.com/go-redis/redis/v8#NewClusterClient
Proxy cluster, stand-alone, or active/standby: https://pkg.go.dev/github.com/go-redis/redis/v8#New Client

Python

redis-py-cluster

https://github.com/Grokzen/redis-py-cluster#usage-example

C

hiredis-vip

https://github.com/vipshop/hiredis-vip?_ga=2.64990636.268662337.1603553558-977760105.1588733325

C++

redis-plus-plus

https://github.com/sewenew/redis-plus-plus?_ga=2.64990636.268662337.1603553558-977760105.1588733325#redis-cluster

Node.js

node-redisio-redis

https://github.com/NodeRedis/node-redishttps://github.com/luin/ioredis

Why Do I Need to Configure Timeout for Redis Cluster?

When connecting to a Redis Cluster instance using Spring Boot and Lettuce, the client needs to connect to all cluster nodes, including standby nodes. When a standby node is faulty, the client may have connection problems, especially when timeout is not configured.

Specifically, minute-level blocking (120s in earlier Lettuce versions and 60s in the new version) may occur when there is a faulty standby node. The end-to-end service access time may reach the maximum timeout.

Suggestions:

You are advised to configure the timeout parameter on the client to greatly shorten the timeout on the standby node. You can configure the timeout based on what the service can tolerate. For example, if you need to request Redis twice in an HTTP request and the maximum timeout of an HTTP request is 10s, it is recommended that you set the timeout in Redis to 5s. This prevents service interruption if faults occur due to a long timeout duration or no timeout duration. In this way, the system can deal with the failures of a standby node more efficiently, improving system stability and performance.

 


Ek95LQOZ9ire