当前位置:网站首页>Hash tag usage in redis cluster
Hash tag usage in redis cluster
2022-07-05 11:44:00 【We've been on the road】
hash tag be used for redis In the cluster . It is realized in key Add a {}, for example test{1}. Use hash tag After that, the client is calculating key Of crc16 when , Only calculate {} Data in the . If not used hash tag, The client will be responsible for the whole key Conduct crc16 Calculation . So let's do that hash tag Use .
-
127.0.0.1:6380> cluster keyslot user:
case
-
(
integer) 9491
-
127.0.0.1:6380> cluster keyslot user:
case{1}
-
(
integer) 9842
-
127.0.0.1:6380> cluster keyslot user:info
-
(
integer) 15429
-
127.0.0.1:6380> cluster keyslot user:info{1}
-
(
integer) 9842
-
-
-
You can see through the above code , Don't use
hash tag Corresponding
hash slot Is different , After use, it will correspond to a
hash slot in
advantage :
hash tag The main function is to store a fixed feature data on an instance , Avoid querying instances in the cluster one by one . For example, user information and user order quantity are stored in an instance for subsequent display statistics .
-
Will the user id by
1 The relevant information of is stored in
6380 example
-
127.0.0.1:6380> set
user:info{
1} essential information
-
OK
-
127.0.0.1:6380> set
user:order{
1}
2
-
OK
-
127.0.0.1:6380> keys *
-
1)
"user:order{1}"
-
2)
"user:info{1}"
shortcoming :
It may cause the data to be concentrated in one instance , Cause data skew , For example, the user 1-10000 The data of is stored in an instance .
-
If only
1-
10000 Of users have order information , Then it is equivalent to that all information is stored in
6380 In this instance
-
127.0.0.1:6380> set
user:
1
:order{
1-
10000}
2
-
OK
-
127.0.0.1:6380> set
user:
2
:order{
1-
10000}
2
-
OK
-
127.0.0.1:6380> set
user:
3
:order{
1-
10000}
2
-
OK
边栏推荐
- 7 themes and 9 technology masters! Dragon Dragon lecture hall hard core live broadcast preview in July, see you tomorrow
- [configuration method of win11 multi-user simultaneous login remote desktop]
- 871. Minimum Number of Refueling Stops
- ZCMU--1390: 队列问题(1)
- [mainstream nivida graphics card deep learning / reinforcement learning /ai computing power summary]
- Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
- 15 methods in "understand series after reading" teach you to play with strings
- pytorch-权重衰退(weight decay)和丢弃法(dropout)
- 查看多台机器所有进程
- Risc-v-qemu-virt in FreeRTOS_ Scheduling opportunity of GCC
猜你喜欢
How to make your products as expensive as possible
redis 集群模式原理
The ninth Operation Committee meeting of dragon lizard community was successfully held
Yolov5 target detection neural network -- calculation principle of loss function
Liunx prohibit Ping explain the different usage of traceroute
13.(地图数据篇)百度坐标(BD09)、国测局坐标(火星坐标,GCJ02)、和WGS84坐标系之间的转换
pytorch-权重衰退(weight decay)和丢弃法(dropout)
Evolution of multi-objective sorting model for classified tab commodity flow
1个插件搞定网页中的广告
【pytorch 修改预训练模型:实测加载预训练模型与模型随机初始化差别不大】
随机推荐
[yolov3 loss function]
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
Sklearn model sorting
15 methods in "understand series after reading" teach you to play with strings
How to get a token from tokenstream based on Lucene 3.5.0
Pytorch weight decay and dropout
分类TAB商品流多目标排序模型的演进
Solve readobjectstart: expect {or N, but found n, error found in 1 byte of
idea设置打开文件窗口个数
Zcmu--1390: queue problem (1)
Programmers are involved and maintain industry competitiveness
Cdga | six principles that data governance has to adhere to
【SingleShotMultiBoxDetector(SSD,单步多框目标检测)】
Riddle 1
[leetcode] wild card matching
谜语1
【上采样方式-OpenCV插值】
COMSOL -- establishment of geometric model -- establishment of two-dimensional graphics
Solve the grpc connection problem. Dial succeeds with transientfailure
pytorch-权重衰退(weight decay)和丢弃法(dropout)