当前位置:网站首页>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
边栏推荐
- [office] eight usages of if function in Excel
- Startup process of uboot:
- 2048游戏逻辑
- [crawler] Charles unknown error
- 阻止浏览器后退操作
- Mysql统计技巧:ON DUPLICATE KEY UPDATE用法
- An error is reported in the process of using gbase 8C database: 80000305, host IPS long to different cluster. How to solve it?
- Is it difficult to apply for a job after graduation? "Hundreds of days and tens of millions" online recruitment activities to solve your problems
- 网络五连鞭
- SET XACT_ ABORT ON
猜你喜欢

分类TAB商品流多目标排序模型的演进

中非 钻石副石怎么镶嵌,才能既安全又好看?

How did the situation that NFT trading market mainly uses eth standard for trading come into being?

COMSOL -- 3D casual painting -- sweeping

【yolov5.yaml解析】

CDGA|数据治理不得不坚持的六个原则

COMSOL -- three-dimensional graphics random drawing -- rotation

全网最全的新型数据库、多维表格平台盘点 Notion、FlowUs、Airtable、SeaTable、维格表 Vika、飞书多维表格、黑帕云、织信 Informat、语雀

11.(地图数据篇)OSM数据如何下载使用

Yolov5 target detection neural network -- calculation principle of loss function
随机推荐
Project summary notes series wstax kt session2 code analysis
Risc-v-qemu-virt in FreeRTOS_ Scheduling opportunity of GCC
Shell script file traversal STR to array string splicing
【yolov5.yaml解析】
Solve the grpc connection problem. Dial succeeds with transientfailure
基于Lucene3.5.0怎样从TokenStream获得Token
XML parsing
Sklearn model sorting
[crawler] Charles unknown error
7 大主题、9 位技术大咖!龙蜥大讲堂7月硬核直播预告抢先看,明天见
Prevent browser backward operation
2048 game logic
How to get a token from tokenstream based on Lucene 3.5.0
Question and answer 45: application of performance probe monitoring principle node JS probe
汉诺塔问题思路的证明
NFT 交易市场主要使用 ETH 本位进行交易的局面是如何形成的?
1.php的laravel创建项目
ZCMU--1390: 队列问题(1)
《增长黑客》阅读笔记
Implementation of array hash function in PHP