当前位置:网站首页>Understanding of LSM tree (log structured merge tree)
Understanding of LSM tree (log structured merge tree)
2022-07-23 12:48:00 【liangdu_ Zuker】

0. The term :
WAL (write ahead log) It is an additional log writing , It is used for simple flow record and backup .
LSM-tree (Log Structured-Merge Tree), Known as one of the Google Troika , It is also an additional log file , But compared with rough WAL, He divided the log into several sections , And every paragraph is indexed ( The query performance of each segment is Ologn ).
SStables (Sorted Strings Table) It can be regarded as a map surface , But his queries rely on tree indexes , The complexity of the query is Ologn, He put the key-values Write a table , Then give this form key Sort , Then insert the sorted index table into the end of the array , There is a map structure .
Here's the picture :![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-xgisLNHn-1649671365411)(:/040e35933b784c30a3bd681734703199)]](/img/94/c46d04b4d09268880df69e210c89a1.png)
1.LSM-tree, Another name of is bigtable
I think it's more accurate to say , Is a long array , The element of an array is a key-value Pairs .
1.1 When writing :
Add elements to the end of the file where the array information is stored , And build a sequential index for it ( The index can facilitate the subsequent rapid passage key Positioning elements ).
When the array is appended to a certain extent ( such as 10M), The file can't be put , Just create a new file , Create a new array index for this file .
1.2 When reading :
When reading , Is to find the documents one by one , If there is k File , Each file has n Elements , Then the total length of the array is k*n , The complexity of the query is k * O(logn).
1.3 Optimization plan :
To avoid the number of documents k More and more , The background will regularly merge small files into large files , namely , Merge the elements of the small file , Build a bigger sstable Indexes .
1.4 Other optimizations :
1) Yes sstable The file is compressed in segments , Improve bandwidth utilization .
2) use LRU Wait for dinner yes sstable Page memory management , Improve cache access performance .
3)bloom filter, Search for key Skipping must not include key The file of , Speed up the search
4) Choose the right time to merge files , Avoid affecting reading performance .
边栏推荐
猜你喜欢

C# 自定义栈(Stack)

Unity3d+GameFramework:资源分析,资源依赖,循环依赖检测

C#:快速排序,有相同的数字会忽略,然后继续先前的寻找方向去找下一个满足要求的数字进行替换

Hcip--- BGP related configuration (Federal chapter)

Implementation of binary tree -c

DHCP 第二次实验

Unity3d:ugui source code eventsystem input system FAQ

unity3d:向量计算,AOE图形相交

OSPF的链路扩展配置

Unity在URP管线下使用TriLib插件加载模型材质不正确的问题
随机推荐
0数组 LeetCode605. 种花问题
刷题笔记:二叉树剪枝(递归,迭代)
HCIP---条件匹配和OSPF协议
线程池总结
《Kubernetes in Action》第二章笔记
Unity3D+moba+技能指示器(一)
0动态规划 LeetCode918. 环形子数组的最大和
详解TCP连接的释放
HCIP---BGP相关配置
Analysis of Internet Protocol (II)
Unity3d:UGUI,UI与特效粒子层级,2018.2以上版本BakeMesh,粒子在两个Image之间且在ScrollView
GameFramework:资源热更代码分析,检查版本信息,下载版本文件,校验版本文件,得到更新文件数量,下载文件,TaskPool
hot 100 动态规划
Unity3d: special effect object pool, timeout delete GameObject in the pool, GC weight
C# 自定义集合
C语言也能写植物大战僵尸
HCIP-第一次实验
Basic knowledge of high voltage technology
DHCP 第二次实验
The correspondence between the concept of go ability and the concept of software development ability