Google File System
Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung
資工二 陳力, 林祐萱
What we talk about
          Brief Idea
            System Architecture
            Protocol
          這是關於2003年至今(?)的 Google File System 架構...
Assumptions
物美價廉的機器
普遍都是GB-size的檔案
wordload:- 
large sequential & small random reads
- mostly appending data.
很多 client 同時 append 到同個檔案.=> Atomicity & minimal synchronization overheadInterface
NO POSIX. NO standard API.
create, delete, read, etc.
2 special: snapshot & record append
File
is divided into
chunks.
Chunk?
- 64MB >> Linux 4KB block
- Why so big?
- Each chunk are stored in 3 chunkservers.
Keep in memory
            - namespace of files, ex: /etc/passwd
- mapping files to chunks
- location of chunks(including each replica)
In charge of
            - 第一線接待 client 們
- 確認每個 chunkserver 死活
- 活著很好 死了要找替代的
- 確認每個 chunk 有好好活著
Operation Log
            - 紀錄 client 做的操作
- 透過模擬這些操作可以回到過去
- 回到無痛無病的健康時期
可以直接對 chunk 操作
            - 讀
- 寫
- 紀錄 chunk 的版本
- 紀錄對 chunk 操作的 log
本質是 linux 機器
            每個 chunk 只是 linux filesystem 裡一個檔案 
            對 chunk 的 cache 不用煩惱 
            ext4 本身很智慧
          1. client 說:「我要寫東西到檔案 foo 的某個 chunk A 上」
            問 master 那個檔案的那個 chunk 在哪裡
          2. master 告訴 client:「這些 ... chunk server 上有」
            發個 lease 給其中隨意一台 chunk server (稱為 Primary) 
            告訴 client 哪一台 server 是 Primary 
            (其他稱為 Secondary) 
            接下來 client 都是跟 Primary 互動
          3. 把要寫的 data 想辦法送到每個 chunk server
            client 不一定是送到 Primary 
            看網路環境
          4. client 告訴 Primary :「要寫在某某offset」
            Primary 把這個操作紀錄下來 
            更新 chunk 的版本號
          5. Primary 告訴 Secondary:「要做這個操作」
            照著這個操作的 serial number apply 到 chunk 上
          6. 其他 chunk server 告訴 Primary :「做好了>///<」
          7. Primary 回報給 client 說完成了
            有可能會回傳錯誤 
            因為可能某個 Secondary chunk 機器壞掉之類的
          Comments
            Data flow 與 control flow 分開,Data 可以從 Secondary 再流回 Primary
              By Assumption(3), Most case is append.
            寫在某個檔案最後面
            多後面呢? 
            offset 是 Master 給的
          複製檔案/資料夾
            先把那些 chunk 的 lease 回收
          Copy On Write
            Master 記 Reference Count 在 Chunk metadata 上 
            要改的時候再去叫 chunk server 複製
           
    
Google File System
Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung
資工二 陳力, 林祐萱