Updated on 2024-12-31 GMT+08:00

DCS Best Practices

This section summarizes best practices of Distributed Cache Service (DCS) in common scenarios. Each practice is given a description and procedure.

Table 1 DCS best practices

Best Practice

Description

Serializing Access to Frequently Accessed Resources

Describes how to implement locks on distributed applications with Redis. Serializing access to hot resources with locks avoids oversold inventory or disordered access in flash sales.

Ranking with DCS

Describes how to rank best-selling offerings using DCS for Redis.

Implementing Bullet-Screen and Social Comments with DCS

Describes how to display a key-value list, such as streaming or social comments, in descending order from different dimensions using DCS for Redis.

Merging Game Servers with DCS

Describes how to synchronize servers using Redis. During game server provisioning and merging, game developers must consider how to synchronize data among different servers. With the pub/sub message queuing mechanism of DCS for Redis, data changes on one game server can be published to Redis channels. Other game servers can subscribe to the channels to receive messages of changes.

Flashing E-commerce Sales with DCS

Describes how to satisfy high concurrency in e-commerce flash sales using DCS for Redis as the database cache. Clients can access Redis to query inventories and place orders.

Reconstructing Application System Databases with DCS

Describes how to migrate data, taking the example of migrating a table from a MySQL database to DCS for Redis.

Upgrading a Redis 3.0 Instance

Describes how to upgrade a DCS Redis 3.0 instance through data migration and IP switchover. You are advised to upgrade your DCS Redis 3.0 instances as soon as possible. DCS for Redis 4.0 and later are compatible with Redis 3.0.

Using Nginx for Public Access to DCS

Huawei Cloud DCS Redis 4.0 and later cannot be bound with elastic IP addresses (EIPs) and cannot be accessed over public networks directly. This best practice describes how to access a single-node, master/standby, read/write splitting, or Proxy Cluster DCS Redis 4.0, 5.0, or 6.0 instance by using a jump server. This solution is unavailable for public access to Redis Cluster instances.

Using SSH Tunneling for Public Access to DCS

Huawei Cloud DCS Redis 4.0 and later cannot be bound with EIPs and cannot be accessed over public networks directly. This best practice describes how to create an SSH tunnel as a proxy to connect your DCS instance and local computer to achieve proxy forwarding. In this way, single-node, master/standby, read/write splitting, and Proxy Cluster DCS Redis instances in a VPC can be accessed. This solution is unavailable for public access to Redis Cluster instances.

Using ELB for Public Access to DCS

Huawei Cloud DCS Redis 4.0 and later cannot be bound with EIPs and cannot be accessed over public networks directly. This best practice describes how to access a single-node, master/standby, read/write splitting, or Proxy Cluster instance or a node in a Redis Cluster instance through public networks by enabling cross-VPC backend on a load balancer.

Connecting a Client to DCS Through CCE

More and more applications are deployed in containers. This practice describes how to deploy Redis clients in cluster containers to access DCS through Cloud Container Engine (CCE).

Configuring Redis Client Retry

This best practice describes the retry configuration of the Jedis client. A complete automatic retry mechanism can greatly reduce the impact of infrastructure or running environment faults.

DCS Data Security

This best practice provides actionable guidance for enhancing the overall security of using DCS.

Suggestions on Using DCS

This best practice describes suggestions on using DCS for Redis in terms of the service, data design, commands, SDKs, and O&M management.

Detecting and Handling Big Keys and Hot Keys

This best practice describes how to find and optimize big keys and hot keys when using DCS for Redis.

Configuring a Redis Pipeline

This best practice describes how to use Redis pipelines. DCS for Redis supports the native pipelining.

Optimizing the Jedis Connection Pool

JedisPool is the connection pool of the Jedis client. This best practice describes how to configure JedisPool for better Redis performance and resource utilization.