当前位置:网站首页>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 .
边栏推荐
猜你喜欢
![[bootloader architecture and brushing process based on UDS service]](/img/c7/de4f1e32f89173e18d74d2f624f3f9.png)
[bootloader architecture and brushing process based on UDS service]

Hcip--- BGP related configuration

Basic OJ exercise of binary tree-

C# 自定义Queue队列集合

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

Unity在URP管线下使用TriLib插件加载模型材质不正确的问题

Unity3d:ugui, UI and special effect particle level, bakemesh above 2018.2, particles between two images and in Scrollview

OSPF和RIP的路由扩展配置

Using one-way linked list to realize queue

unity3d:向量计算,AOE图形相交
随机推荐
HCIP --- HDLC和PPP协议
Design experience of log file IO system
Basic OJ exercise of binary tree-
刷题笔记:二叉树的中序遍历(三种解法-递归,迭代,Morris)
剖析Redis中的Sentinel模式
Openssl自行签证流程概述
Unity shader missing problem
剑指 Offer做题总结
关于搭建Hybrid App所需要的基础技术一文
整数乘以整数溢出了
0回溯/动态规划中等 LeetCode526. 优美的排列
0数组 LeetCode605. 种花问题
[AUTOSAR DCM 1. module introduction (DSL, DSD, DSP)]
浅析互联网协议(一)
Sql Server性能分析,查看慢查询
Basic knowledge of high voltage technology
读《凤凰架构》- RPC的历史与知识
How far is the first kind of mistake from us
C # custom stack
How to write a web page with a common text editor