CurveBS IO Processing Flow1. A CopySet, as the basic unit of a consistent replication group, contains Consensus Module and Log Module. 2. The State Machine corresponds to the chunk in the CurveBS, and it applies the operations NEBDClient, it just proxy requests and has limited retries, which ensuring that NEBDClient needs no change. To upgrade curve-client, you only need to restart the NEBDServer, which affects services in BRaft node.3. The BRaft node persists the log entry locally and replicates it to the followers so that the followers can also persist the log entry. BRaft Log Format: EntryHeader + Entry.0 码力 | 13 页 | 2.03 MB | 6 月前3
Curve文件系统元数据管理→ hashtable(inode id) fsedge → hashtable (parent inode + name) 全内存 chunk → hashtable(chunk id) log + dump record 差 否 chunk 链式多副本 overwirte有数据不一致风险 chubaofs(cfs) 有元数据服务器 inode → b tree(key ino) dentry 内部结点不保存数据,只有叶子结点保存数据。 https://github.com/begeekmyfriend/bplustree,(MIT),实现了落 盘 BST O(log(n)) O(n) c++ stl 模板© XXX Page 4 of 24 skip list O(log(n)) O(n) level db,https://github.com/google/leveldb/blob/master/db/skip uint64_t fsId; // uint32_t btime; /* birth / create time */ uint32_t ctime; /* status change time */ uint32_t mtime; /* modify time */ uint32_t atime; /* access time */ uint32_t0 码力 | 24 页 | 204.67 KB | 6 月前3
Curve核心组件之chunkserver写请求: 1. Client发送写请求给Leader ChunkServer 2. 请求封装,提交给Raft node 3. 本地持久化entry的同时发送给其他peer 4. 本地持久化log entry成功,并且有一个peer也落 盘成功,则commit 5. Commit后apply,此时把写请求写到chunkChunkServer核心模块-CopysetNode 坏盘(CS1对应的盘)后的迁移流程 3的副本CS1 offline, 生成change peer from CS1 to CS2的operator给这三个copyset ④ MDS通过RPC在CS2上创建copyset1,2,3这三个copyset ⑤ 假定三个copyset的leader都是CS3,在CS3的下一次心跳的 response中,下发第三步生成的三个operator ⑥ CS3收到change peer from CS1 的copyset最多,生成change peer from CS2 to CS1的operator给 部分copyset,比如copyset1,2,3 ⑤ MDS通过RPC在CS1上创建copyset1,2,3这些copyset ⑥ 假定三个copyset的leader都是CS3,在CS3的下一次心跳的 response中,下发第四步生成的三个operator ⑦ CS3收到change peer from0 码力 | 29 页 | 1.61 MB | 6 月前3
Raft在Curve存储中的工程实践add_peer(const PeerId& peer, Closure* done); void remove_peer(const PeerId& peer, Closure* done); void change_peers(const Configuration& new_peers, Closure* done); StateMachine void on_apply(::raft::Iterator& ChunkServer。 2. ChunkServer 收到请求,将请求封装成一个 log entry,提交给 raft。 3. raft模块在本地持久化 entry 的同时发送 entry 给其 他副本(ChunkServer)。 4. 本地持久化 log entry 成功,且另一个副本也写入 log entry 成功则 commit。 5. commit 后执行 apply,apply 03 raft在Curve中的应用 05 Q&A 04 Curve对raft的优化Curve对RAFT的优化 优化点一:轻量级快照 问题背景: raft的快照需要定期打快照,用来清理log。对于Curve块存储场景,系统状态就是Chunk当前的数据。 如果把所有chunk 拷贝一遍打快照,会出现两个问题: 1. 每次快照,空间上要多出1倍,空间浪费严重。 2. Curve块存储快照间隔默认300 码力 | 29 页 | 2.20 MB | 6 月前3
BRPC与UCX集成指南UCP把若干个UCT组合起 来,自动选择最快路径传输。 ●高级特性 –大消息报文的自动分片传输 –Active message, atomic operation, tag match, stream27 典型的RDMA栈28 UCX 编程的一些基本概念 ●Context –收集机器资源(内存,网卡等),在应用的各个部分共享 ●Worker –完成ucx的功能,可以在应用程序中调用的函数(不是单独执行的线程) –连接对象,在ep上请求发送和接收29 UCP 消息接口类型 ●Active message –速度最快,被brpc使用作为消息传递 –消息通过回调函数接收 –消息异步发送 ●Tag –MPI使用 ●Stream –官方不推荐30 WORKER ●worker是UCX通讯中的核心概念,它是一个进度引擎(progress engine) ●worker既不是协程也不是线程,而是一个状态机,可以通过不停地调用0 码力 | 66 页 | 16.29 MB | 6 月前3
Open Flags 调研fi->fh. There are also some flags (direct_io, keep_cache) which the filesystem may set in fi, to change the way the file is opened. See fuse_file_info structure infor more details. If ret = inodeManager_->UpdateInode(inode); if (ret != CURVEFS_ERROR::OK) { LOG(ERROR) << "inodeManager update inode fail, ret = " << ret << ", inodeid = " 0 码力 | 23 页 | 524.47 KB | 6 月前3
CurveFS方案设计在数据库等场景,文件的目录层级较少,文件数量较少,文件很大。这种情况inode比较聚集,一般分布在几个复制组上。inode数量少。 以上这两种情况,以20TB为例,数据量在MB级别,client获取数据可以使用stream类型的rpc? ③ 正常使用场景,有一定的目录层级,文件分配数量较多,文件较小。这种情况inode比较分散,一般分布在多个复制组上,inode数量较多。 client获取数据可以并发从多个复制组中获取。0 码力 | 14 页 | 619.32 KB | 6 月前3
Curve文件系统元数据持久化方案设计© XXX Page 1 of 12 元数据持久化© XXX Page 2 of 12 前言 Raft Log Raft Snapshot 持久化文件 key_value_pairs 其他说明 实现 1、inode、entry 的编码 2、KVStore Q&A 单靠 redis 的 AOF 机制能否保证数据不丢失? redis 的高可用、高可扩方案? redis + muliraft 前言 根据之前讨论的结果,元数据节点的架构如下图所示,这里涉及到两部分需要持久化/编码的内容: Raft Log:记录 operator log Raft Snapshot:将内存中的数据结构以特定格式 dump 到文件进行持久化© XXX Page 3 of 12 Raft Log +------+------------+-----+----------------+---------+----------+ feedAppendOnlyFile(cmd, ...) server.aof_buf = sdscatlen(server.aof_buf, ...) // op log buffer aofRewriteBufferAppend(...) /************************************************/0 码力 | 12 页 | 384.47 KB | 6 月前3
CurveFS S3本地缓存盘方案= 1024*4; LOG(INFO) << "whs start write."; for(int i = 0; i < 100000; i++) { char str[5]; sprintf(str, " %d" , i); Write(str, buf, length); } LOG(INFO) << "whs write."; 如上,写10万个4k文件,最终耗时5秒左右,如下: hzwuhongsong@pubbeta1-nostest2:/mnt$ sudo cat /data/log/curve/libcurve-cb6f5cfd.log.INFO.20210825-171813.1930722 | grep whs | egrep "start|end" I 2021-08-25T17:18:130 码力 | 9 页 | 150.46 KB | 6 月前3
Curve元数据节点高可用= leaderElection->CampaginLeader() || false == leaderElection->LeaderKeyExist()) { LOG(INFO) << leaderElectionOp.leaderUniqueName << " campaign for leader agin"; } le Key()) errCode := GetErrCode(EtcdGet, err) if errCode != C.OK { log.Printf("Observe can not get leader key: %v, startTime:" + " %v, spent: %v", election return C.ObserverLeaderInternal } else if len(resp.Kvs) == 0 { log.Printf("Observe find leader key%v not exist", election.Key()) return0 码力 | 30 页 | 2.42 MB | 6 月前3
共 14 条
- 1
- 2













