笔记 MIT6.824 Lecture 11: Cache Consistency Frangipani

Lecture 11: Cache Consistency: Frangipani

前言

这是Lecture11的上课记录,主要讲的是分布式文件系统通过cache提高性能的一个话题,设计到三大问题,后面会一一解决。很多解决问题的方法挺好的,但是就目前来说cache不是人们设计distributed system的设计方向了

参考链接
课程视频
参考笔记


一、 Frangipani overview

Petal (virtual disk) is the share server that stores directory or iNodeinformation 在这里插入图片描述

共享方式大概是大家都可以看到对方创建/修改的文件 - 共享文件系统。其实就是a network file system that works trnasparently with existing apps (text editors &c)。

Caching
如果每个server都有caching,很多时候就不需要跟Petal通信获得文件信息,提升速度。并且还有write-back caching,就是如果只有一个Frangipani使用,write的操作也是在Frangipani中进行的,也就是在local memory中进行。这个就是去中心话的设计


二、 Challenges

来自去中心化带来的问题

问题1 用户想知道其他Frangipani的修改,方法
Cache coherence

问题2 两个Frangipanis同时修改
Atomicity

问题3 一个workstations crash
Crash recovery of individual server


三、 Cache coherence

解决方法:Lock server

上图可以看见,即便server不需要lock也会先hold主lock,状态为IDEL,这个lock的handover方式lazy的,这样有利于这个sever往后面继续添加log而不用acquire lock

Rules
No cached data without lock
Acquire the lock & read from petal
Write petal, release the lock

Coherence protocol
Request message ws -> ls
Grant ls -> ws
Revoke ls -> ws
Release ws -> ls

流程图
在这里插入图片描述

读写
如果很多ws都已经acquire read lock,当一个写操作过来的时候需要acquire所有的read lock才能写

四、Atomic multi-step operation

解决方法 distributed transaction system

Acquire ALL locks
All updates
Write petal
Release

这个方法就是保证别的ws在完成operation前看不见logs,而coherence Protool则是让不同的servers看见writes

五、Crash recovery

Crash with locks
Write ahead logging
就是ws会提前告诉petal它会执行的整个Transaction操作,然后ws再执行

Per-ws logs
Logs in petal

Log entry contents
Log sequence number
Description of each modification
Block number
Version number
Data

Revoke的sequence
Write log -> petal, then
Write updated blocks for lock, then
Send a release message

Scenario
Revoke没有回复 - 在revoke sequence 1 之前
知道ws crash了,read log & replay all the recent operations
在revoke sequence 1&2 之间
Replay according to the log entry from step 1 but recover the complete operations

Delete and crash
在这里插入图片描述
解决方法:
使用version number

六、总结

适用面不是很广,对于big data,caching就很不实用了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值