Tair (Redis OSS-compatible) delivers high-performance in-memory data processing. Follow these development and O&M standards for Tair (Redis OSS-compatible) to build efficient systems and maximize Tair. Based on years of Alibaba Cloud O&M experience, these standards cover business deployment, key design, SDK usage, command usage, and O&M management.
Performance boundaries of Tair
Figure 1. Performance boundaries of Tair
|
Resource type |
Description |
|
Computing resources |
Wildcards, concurrent Lua scripts, one-to-many PUBSUB, and hotkeys consume heavy computing resources. For cluster instances, these items can also cause request skew and shard underutilization. |
|
Storage resources |
Streaming jobs and large keys consume heavy storage resources. For cluster instances, these items can also cause data skew and shard underutilization. |
|
Network resources |
Database-wide scans (KEYS) and range queries on large keys and values (HGETALL) consume heavy network resources and often cause thread congestion. Important
The high-concurrency capability of Tair does not significantly improve access performance as expected but does affect the overall performance of Tair. For example, the storage of large values in Tair does not improve access performance to a large degree. |
For cluster instances, hotkeys, large keys, or large values can also cause skewed storage or skewed requests . In a production environment, it is important to avoid reaching the performance boundaries of Tair.
Business deployment standards
|
Importance |
Standard |
Description |
|
★★★★★ |
Determine whether the scenario is high-speed cache or in-memory databases . |
|
|
★★★★★ |
Deploy your application in the same virtual private cloud (VPC) as your Tair instances, such as on an Elastic Compute Service (ECS) instance. |
Tair delivers high performance, but deploying far from Tair instances or connecting over the Internet significantly degrades performance due to network latency. Note
For cross-region deployment, use Global Distributed Cache for geo-disaster recovery, active geo-redundancy, and reduced latency. |
|
★★★★☆ |
Create a Tair instance for each service. |
Do not share a Tair instance across services. Mixing cache and in-memory database workloads causes eviction policies, slow queries, and FLUSHDB command execution of one service to affect others. |
|
★★★★☆ |
Configure appropriate eviction policies to evict expired keys. |
The default eviction policy for expired keys in Tair is volatile-lru . Configure eviction policies in Parameters that can be configured for Redis Open-Source Edition instances. |
|
★★★☆☆ |
Manage stress testing data and duration. |
Tair does not delete stress testing data. To prevent impacts on your business, you must manage stress testing data and duration yourself. |
Key design standards
|
Importance |
Standard |
Description |
|
★★★★★ |
Keep values below 10 KB. |
Oversized values cause data skew, hotkeys, high bandwidth, or high CPU utilization. |
|
★★★★★ |
Use descriptive, concise key names. |
|
|
★★★★★ |
Limit sub-keys per complex data structure to fewer than 1,000. Note
Common complex data structures include Hash, Set, Zset, Geo, and Stream, and structures specific to Tair (Enterprise Edition), such as exHash, Bloom, and TairGIS. |
The time complexity of commands like HGETALL scales with sub-key count. Frequent O(N)+ commands on keys with excessive sub-keys cause slow queries, data skew, and hotkeys. |
|
★★★★☆ |
Serialize values into readable structures. |
Language bytecode can change between versions. Storing raw objects (Java, C#) in Tair makes stack upgrades difficult. Serialize values into readable structures instead. |
SDK usage standards
|
Importance |
Standard |
Description |
|
★★★★★ |
Use JedisPool or JedisCluster to connect to Tair instances. Note
Use the TairJedis client for Tair (Enterprise Edition) DRAM-based instances — it provides encapsulation classes for new data structures. Use a client to connect to an instance. |
Single connections cannot automatically reconnect after a timeout. Configure JedisPool connections: Use a client to connect to an instance, JedisPool optimization, and JedisCluster. |
|
★★★★☆ |
Design proper fault tolerance mechanisms for your clients. |
Network fluctuations and high usage of resources may cause connection timeouts or slow queries in Tair. To prevent these risks, you must design proper fault tolerance mechanisms for your clients. |
|
★★★★☆ |
Use adequate retry intervals. |
Retry intervals shorter than 200 ms can trigger rapid retries and cause a service avalanche. Retry mechanisms for Redis clients. |
Command usage standards
|
Importance |
Standard |
Description |
|
★★★★★ |
Avoid range queries such as KEYS *. Use point queries or SCAN instead. |
Range queries may cause service interruptions, slow queries, or congestion. |
|
★★★★★ |
Use extended data structures (Integration of multiple data modules) instead of Lua scripts. |
Lua scripts consume heavy computing and memory resources without multi-threading support. Complex or improper scripts can exhaust resources. |
|
★★★★☆ |
Use pipelines to reduce the round-trip time (RTT) of data. |
When your client does not depend on individual responses, batch commands with a pipeline. Guidelines:
|
|
★★★★☆ |
Use Redis commands correctly. |
Transaction command limits:
|
|
★★★★☆ |
Avoid large-scale message distribution with Pub/Sub commands. |
Pub/Sub lacks data persistence and acknowledgment mechanisms. Distributing messages larger than 1 KB to over 100 subscribers can exhaust server resources and cause message loss. Note
To improve performance and balance, Tair optimizes Pub/Sub in cluster instances by hashing commands to data nodes based on channel names. |
O&M management standards
|
Importance |
Standard |
Description |
|
★★★★★ |
Understand the impacts of different instance management operations. |
Configuration changes or restarts can cause transient disconnections on a Tair instance. Understand the impacts before proceeding. Instance states and impacts. |
|
★★★★★ |
Test client error handling and disaster recovery logic. |
Tair monitors node health and automatically triggers master-replica switchover when a master becomes unavailable. Before a client goes to production, manually trigger a switchover to verify error handling and disaster recovery logic. Manually switch workloads from a master node to a replica node. |
|
★★★★★ |
Disable time-consuming or high-risk commands. |
Command abuse in production can cause data loss (FLUSHALL) or network congestion (KEYS). Disable risky commands to improve stability. Disable high-risk commands. |
|
★★★★☆ |
Handle pending events promptly. |
Alibaba Cloud generates pending events for hardware upgrades, software updates, or network maintenance — for example, when a minor database version needs updating. Review the impact and reschedule if needed. View and manage scheduled events. |
|
★★★★☆ |
Configure alerts for core metrics. |
Monitor CPU utilization, memory usage, and bandwidth in real time with Alert settings. |
|
★★★★☆ |
Regularly check instance health using Tair O&M features to troubleshoot resource anomalies. |
|
|
★★★☆☆ |
Enable the audit log feature and evaluate audit logs. |
The audit log feature records write operations and supports querying, online analysis, and export. Use it to monitor instance security and performance. Audit Log. Important
After you enable the audit log feature, the performance of Tair instances may degrade by 5% to 15%, depending on write and audit volume. For write-heavy Tair workloads, enable audit logs only during O&M operations such as troubleshooting. |