https://www.alluxio.org/docs/1.6/cn/Tiered-Storage-on-Alluxio.htmlhtml
引入分層存儲後,Alluxio管理的數據塊不僅在內存中,可存放於任何可用的存儲層。Alluxio使用分配策略和回收策略管理塊的存放和移動。Alluxio根據I/O性能的高低從上到下配置存儲層。所以,這種配置策略決定了最頂層存儲是MEM,而後是SSD,最後是HDD。node
層次化存儲是做爲分佈式緩存的最爲核心的特性,加速讀取/寫入緩存
層次化存儲也是worker組件最重要的功能,同時支持橫向擴展安全
接上文https://www.cnblogs.com/victor2302/p/10491974.html,咱們講到了BlockWorker接口session
該接口的實現實現類:DefaultBlockWorker架構
主要負責幾種功能:框架
成員變量以下:
/** Runnable responsible for heartbeating and registration with master. */ 和master節點的心跳任務 private BlockMasterSync mBlockMasterSync; /** Runnable responsible for fetching pinlist from master. */ 獲取master pin列表的任務 private PinListSync mPinListSync; /** Runnable responsible for clean up potential zombie sessions. */ private SessionCleaner mSessionCleaner; /** Client for all block master communication. */ 與block master通信 private final BlockMasterClient mBlockMasterClient; /** * Block master clients. commitBlock is the only reason to keep a pool of block master clients * on each worker. We should either improve our RPC model in the master or get rid of the * necessity to call commitBlock in the workers. */ private final BlockMasterClientPool mBlockMasterClientPool; /** Client for all file system master communication. */ 與file system交互的客戶端 private final FileSystemMasterClient mFileSystemMasterClient; /** Block store delta reporter for master heartbeat. */ 報告者 private BlockHeartbeatReporter mHeartbeatReporter; /** Metrics reporter that listens on block events and increases metrics counters. */ 報告者 private BlockMetricsReporter mMetricsReporter; /** Session metadata, used to keep track of session heartbeats. */ private Sessions mSessions; /** Block Store manager. */ mBlockStore是TieredBlockStore,爲多級存儲block存儲管理器 private BlockStore mBlockStore; private WorkerNetAddress mAddress; /** The under file system block store. */ ufs管理器 private final UnderFileSystemBlockStore mUnderFileSystemBlockStore; /** * The worker ID for this worker. This is initialized in {@link #start(WorkerNetAddress)} and may * be updated by the block sync thread if the master requests re-registration. */ private AtomicReference<Long> mWorkerId;
涉及到交互的方法 | 代碼 | 註釋 | |
commitBlock | blockMasterClient.commitBlock | 提交bolock | |
start | mBlockMasterClient.getId(address) | 獲取workerId | |
心跳類方法 | 代碼 | 註釋 | |
PinListSync |
Set<Long> pinList = mMasterClient.getPinList();
mBlockWorker.updatePinList(pinList);
|
更新本地的pin列表 | |
SessionCleaner |
for (long session : mSessions.getTimedOutSessions()) {
mSessions.removeSession(session);
for (SessionCleanable sc : mSessionCleanables) {
sc.cleanupSession(session);
}
}
|
清除session | |
SpaceReserver | 太多 | 各存儲層空間檢查 | |
BlockMasterSync |
cmdFromMaster = mMasterClient.heartbeat(mWorkerId.get(), storeMeta.getUsedBytesOnTiers(),
blockReport.getRemovedBlocks(), blockReport.getAddedBlocks(), metrics);
handleMasterCommand(cmdFromMaster);
|
向blockmaster發送心跳,並處理返回的消息 |
該類負責分層存儲邏輯,與不一樣介質的緩存存儲模塊進行交互分佈式
維護讀寫鎖,保證block操做的線程安全性能
該類擁有前文提到過得申請和驅逐策略以及 pinned列表fetch
備註:申請和驅逐策略,就是關於不一樣介質的緩存存儲模塊如何進行分配以及管理的策略
//申請策略接口 private final Allocator mAllocator; //驅逐策略接口 private final Evictor mEvictor; private final Set<Long> mPinnedInodes = new HashSet<>();