- 博客(116)
- 收藏
- 关注
原创 TiDB 事务 GC 源码分析——resolveLocks
TiDB事务GC时,会由TiDB的gc worker线程推进safepoint。并进行resolveLocks
2022-04-29 22:45:10
762
原创 [代码]Rust 对比C++的hashmap和hashbrown hashmap
对比C++的hashmap和hashbrown hashmapmod main2;use std::collections::HashMap;use chrono::prelude::*;fn test2() { // 创建一个HashMap,用于存储宝石种类和对应的数量 let mut my_gems = HashMap::new(); for i in 0..10000000 { // 将宝石类型和对应的数量写入表中 my_gems
2022-04-19 10:22:20
1093
原创 Rocksdb Flush
启动的时候原生会加载数据到memtable然后flush,下面文章做了简单优化Rocksdb Secondary Instance启发与实践 - 知乎前言最近在做rocksdb的集群化改造,期间遇到了很多问题,也有很多的思考与感悟,这里希望与大家分享一下。 简单介绍RocksdbLevelDB是由Google开源的,基于LSM Tree的单机KV数据库,其特点是高效,代码简洁而优美。…https://zhuanlan.zhihu.com/p/147527659TryInstallMe...
2022-02-02 20:55:18
1106
原创 toplingDB编译踩坑
toplingdb编译项目地址GitHub - topling/toplingdbContribute to topling/toplingdb development by creating an account on GitHub.https://github.com/topling/toplingdb1.分支使用哪个?——使用默认的分支2.缺少库No package gflags-devel available.解决方案:github 上 clone...
2022-01-09 19:03:54
400
原创 Raft论文翻译(8)——客户端
This section describes how clients interact with Raft, including how clients find the cluster leader and how Raft supports linearizable semantics [10]. These issues apply to all consensus-based systems, and Raft’s solutions are similar to other sys...
2021-12-22 21:47:29
1499
原创 Raft论文翻译(5.5)——follower和候选人crash
5.5 Follower and candidate crashesUntil this point we have focused on leader failures. Fol- lower and candidate crashes are much simpler to han- dle than leader crashes, and they are both handled in the same way. If a follower or candidate crashes, then f
2021-12-22 21:39:50
1314
原创 Raft论文翻译(5.3)——日志复制
5.3 Log replicationOnce a leader has been elected, it begins servicing client requests. Each client request contains a command to be executed by the replicated state machines. The leader appends the command to its log as a new entry, then issues AppendEnt
2021-12-22 10:32:31
1487
原创 Raft论文翻译(5.2)——Leader选举
5.2 Leader electionleader选举Raft uses a heartbeat mechanism to trigger leader elec- tion. When servers start up, they begin as followers. A server remains in follower state as long as it receives validRPCs from a leader or candidate. Leaders s...
2021-12-22 10:03:32
520
原创 java使用Rocksdb
Rocksdb下进行编译make -j64 rocksdbjava DEBUG_LEVEL=0产生的.so文件需要放到java/libs目录下面!!!!否则正式执行的时候会找不到然后cd java执行打包:mvn clean package -DskipTests或者install到本地 maven 库:mvn clean install -DskipTests...
2021-12-20 18:40:21
1743
原创 RocksDB row cache
使用的调用链路db.get 先查memtable,找到直接返回 memtable找不到再请求table_cache的Get,找row cache,row cache找不到再找下面block cache;初始化LRUCache::LRUCache(size_t capacity, int num_shard_bits, bool strict_capacity_limit, double h...
2021-12-20 16:53:42
1133
原创 BRaft example解析
client.cpp模拟客户端通过pthread_create创建线程bthread_start_background启动线程间隔1s打印一下QPS while (!brpc::IsAskedToQuit()) { sleep(1); LOG_IF(INFO, !FLAGS_log_each_request) << "Sending Request to " << FLAGS_group
2021-12-19 23:22:59
501
原创 Java内存分析工具
因为生产场景下,java堆内存可能比较大,或者dump的内存文件比较大;因此下载到自己电脑再用ecplise分析比较慢;所以通常解决方案是在linux上就进行dump文件的分析;相关工具是 matmat工具下载:Eclipse Memory Analyzer Open Source Project | The Eclipse Foundation在linux上执行./ParseHeapDump.sh hprof文件名 org.eclipse.mat.api:suspects
2021-12-19 18:53:20
1041
原创 Java ZGC知识点梳理
JDK11 之后加入的新垃圾收集器 ZGC,一个Scalable、Low Latency的垃圾回收器一个号称停顿可以在10ms内的java 垃圾收集器(实际停顿在0.5~1ms);ZGC的一些特性:扫描:Region Based:将内存划分为若干块region——在很多的内存管理的策略中都是将内存划分为多个小的部分进行管理;并且划分出的区域有不同大小,使之管理更加灵活;非常多的内存管理策略和垃圾回收策略都使用了这样的思想,将内存划分为若干块;Partial Compaction:
2021-12-09 02:36:20
731
原创 Rocksdb 事务梳理(脑图)
简述:并发控制:在事务的场景中并发控制目前比较常用的解决方案就是snapshot+MVCC;写操作的保序:在写的“排序”上,不管是分布式事务还是单机事务,都需要有机制来保证事务的顺序;比如基于HLC的分布式事务实现中,HLC其实就是用来保序的,而rocksdb中,则通过TryLock来对写操作加锁;乐观vs悲观锁:乐观锁能减少更新操作或者GetForUpdate()时加锁的代价,但更适合冲突少的场景,否则会频繁触发commit失败;参考:RocksDB事务实现Transacti
2021-12-09 01:30:20
499
原创 Raft论文翻译(5.1)——Raft基础
5.1 Raft basicsraft基础A Raft cluster contains several servers; five is a typical number, which allows the system to tolerate two failures. At any given time each server is in one of three states: leader, follower, or candidate. In normal operati...
2021-11-28 22:38:17
1641
原创 Raft论文翻译(5.0)——Raft 一致性算法
The Raft consensus algorithmRaft is an algorithm for managing a replicated log of the form described in Section 2. Figure 2 summarizes the algorithm in condensed form for reference, and Figure 3 lists key properties of the algorithm; the element...
2021-11-28 22:23:34
704
原创 分布式一致性算法Raft论文(4)——为易懂性设计
4 Designing for understandability功能完整,实用是基础。更重要的是可理解性要好。We had several goals in designing Raft: it must provide a complete and practical foundation for system building, so that it significantly reduces the amount of design work required of deve...
2021-11-28 21:51:58
205
原创 分布式一致性算法Raft论文(3)——Paxos的问题
3 What’s wrong with Paxos?难以理解;Over the last ten years, Leslie Lamport’s Paxos protocol [15] has become almost synonymous with consensus: it is the protocol most commonly taught in courses, and most implementations of consensus use it as a sta...
2021-11-28 21:20:03
1289
原创 分布式一致性算法Raft论文(2)——复制状态机
2 Replicated state machines集群中某些服务器不可用,整个集群还可以工作。算法保证安全性;复制日志保持顺序性;Consensus algorithms typically arise in the context of replicated state machines [37]. In this approach, state machines on a collection of servers compute identical copies...
2021-11-28 21:12:01
750
原创 分布式一致性算法Raft论文(1)——介绍
1 Introduction我们需要更易懂的算法,并且更容易在实际场景中工程化。Consensus algorithms allow a collection of machines to work as a coherent group that can survive the failures of some of its members. Because of this, they play a key role in building reliable large-scale softwar
2021-11-28 20:37:02
358
原创 分布式一致性算法Raft论文(0)——简介
动画演示:Raft Consensus Algorithm论文:https://raft.github.io/raft.pdfhttps://pdos.csail.mit.edu/6.824/papers/raft-extended.pdf Extended Version分布式一致性算法:Raft 算法(论文翻译) - lzslbd - 博客园
2021-11-28 20:11:50
1110
原创 io_uring介绍(5)——第十章资料介绍
进一步阅读fio中的示例:git://git.kernel.dk/fio 的io_uring.c git://git.kernel.dk/liburing 接口手册;它还附带了一些测试程序,既有针对开发过程中发现的问题的单元测试,也有技术演示。其他链接:https://lore.kernel.org/linux-block/20190116175003.17880-1-axboe@kernel.dk/https://lwn.net/Articles/776703/...
2021-11-28 01:54:15
539
原创 io_uring介绍(4)library使用与高级特性
内核异步IO io_uring 介绍的第7章,第8章 ——library使用与高级特性io_uring_queue_init 包含了所有 setup SQ and CQ ring信息的逻辑;struct io_uring ring;io_uring_queue_init(ENTRIES, &ring, 0);一旦执行完 ,要调用:io_uring_queue_exit(&ring);基本场景提交一个请求然后等待他完成,使用 li...
2021-11-27 23:51:08
1163
原创 io_uring介绍(2)数据结构
第四章和第五章1.性能性能问题在设计之初就被纳入计划中,否则接口一旦固定,就很难再修改了;我们不需要在提交和完成事件上有内存拷贝,或者像aio一样有间接的内存使用。应用和内核要共享IO的结构和完成的事件;满足我们需求的一种数据结构是单生产者和单消费者环形缓冲区。使用共享环形缓冲区,我们可以消除应用程序和内核之间共享锁定的需要,而不需要巧妙地使用内存顺序和障碍。4.1 数据结构它需要携带与操作结果相关的信息,以及将该完成链接回其发起的请求的某种方式。SQ
2021-11-27 22:56:35
691
原创 redis事务
Redis系列(九):Redis的事务机制 - 申城异乡人 - 博客园一个事务从开始到执行会经历以下三个阶段:开始事务。 命令入队。 执行事务。
2021-11-13 22:58:33
500
原创 Rocksdb CuckooTable Format翻译
CuckooTable Format · facebook/rocksdb Wiki · GitHubhttps://github.com/facebook/rocksdb/wiki/CuckooTable-Format
2021-10-26 15:47:17
316
原创 SSD GC机制简介
背景闪存基本构成:页page(4K)→块block(通常64个page组成一个block,有的是128个)→面plane(多个blcok组成)→die(plane就是一个die)→闪存片(多个die组成)→SSD(多颗闪存片组成);(可能不同型号具体数字不同)。 SSD上已经被写入过的Page页在重新被写入之前,必须要将page页所在的block块擦除,而不是直接覆盖写。这个是由Nand Flash的工作原理决定的。因此产生了Gc的概念;gc触发的位置FTL层gc分类:限制垃圾回收:不占用
2021-10-26 11:55:18
3145
原创 lindorm CCSMAP
原理说明[HBASE-20312] CCSMap: A faster, GC-friendly, less memory Concurrent Map for memstore - ASF JIRAhttps://issues.apache.org/jira/browse/HBASE-20312代码[HBASE-20717] Implement CCSMap - a better concurrent map with compacted data structure - ASF JIRAhtt..
2021-10-22 13:41:02
650
原创 Rocksdb 写数据流程
writeImpl大致流程:一般都要先做一些参数check 写wal 写memtable 更新seq 收尾 流程结束并返回重要知识点:joinBatchGroup相关的status操作 写wal的注意事项 写memtable的内部流程(跳表) sequence相关操作细节流程step 1: 参数的判断 step 2: 写限流的判断 step3: 如果设置不写memtable,直接走writewalonly 然后返回 step4 .
2021-10-20 23:03:52
485
原创 SSD的FTL——深入浅出SSD笔记
Interface Adapter——接口适配:在内部FTL中主要关联eMMC/SCSI/SATA/PCIe/NVMe等接口,而在外部FTL中主要关联Linux Block Device。Address Translation——映射管理地址映射,也可以叫做mapping,负责逻辑地址和物理地址之间的映射,多技术模块都以该机制为核心进行。众所周知,Nand Flash具有写时擦除的特性,因此写入数据时不得不异地更新。Garbage Collection——垃...
2021-09-26 19:54:30
4488
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人