正常情况下,Redis集群中数据都是均匀分配到每个节点,请求也会均匀的分布到每个分片上,但在一些特殊场景中,比如外部爬虫、攻击、热点商品等,最典型的就是明星在微博上宣布离婚,吃瓜群众纷纷涌入路演,导致微博评论功能崩溃,这种短时间内某些key访问量过于大,对于这种相同的key会请求到同一台数据分片上,导致该分片负责较高成为瓶颈问题,导致雪崩等一些问题。
A key-value store, also referred to as a key-value database, is a non-relational database. Each unique identifier is stored as a key with its associated value. This data pairing is known as a “key-value” pair. In a key-value pair, the key must be unique, and the value associated with the key can be accessed through the key. Keys can be plain text or hashed values. For performance reasons, a short key works better. What do keys look like? Here are a few examples: • Plain text key: “last_logged_in_at” • Hashed key: 253DDEC4 The value in a key-value pair can be strings, lists, objects, etc. The value is usually treated as an opaque object in key-value stores, such as Amazon dynamo [1], Memcached [2], Redis [3], etc. Here is a data snippet in a key-value store: 键值存储(也称为键值数据库)是一种非关系数据库。每 唯一标识符存储为键及其关联值。此数据配对称为“键值”对。 在键值对中,键必须是唯一的,并且与键关联的值可以是 通过密钥访问。键可以是纯文本或哈希值。出于性能原因, 短键效果更好。钥匙是什么样子的?以下是一些示例: • 纯文本键:“last_logged_in_at” • 哈希键:253DDEC4 键值对中的值可以是字符串、列表、对象等。该值通常被视为 键值存储中的不透明对象,例如 Amazon dynamo [1]、Memcached [2]、Redis [3]等。 下面是键值存储中的数据片段: