/** * @param view a view of block metadata information * @param allocator an allocation policy */ public LRFUEvictor(BlockMetadataManagerView view, Allocator allocator) { super(view, allocator); mTachyonConf = WorkerContext.getConf(); mStepFactor = mTachyonConf .getDouble(Constants.WORKER_EVICTOR_LRFU_STEP_FACTOR); mAttenuationFactor = mTachyonConf .getDouble(Constants.WORKER_EVICTOR_LRFU_ATTENUATION_FACTOR); Preconditions.checkArgument(mStepFactor >= 0.0 && mStepFactor <= 1.0, "Step factor should be in the range of [0.0, 1.0]"); Preconditions.checkArgument(mAttenuationFactor >= 2.0, "Attenuation factor should be no less than 2.0"); // Preloading blocks for (StorageTierView tier : mManagerView.getTierViews()) { for (StorageDirView dir : tier.getDirViews()) { for (BlockMeta block : dir.getEvictableBlocks()) { mBlockIdToLastUpdateTime.put(block.getBlockId(), 0L); mBlockIdToCRFValue.put(block.getBlockId(), 0.0); } } } }
public SpaceReserver(BlockDataManager blockManager) { mBlockManager = blockManager; List<Long> capOnTiers = blockManager.getStoreMeta().getCapacityBytesOnTiers(); List<Integer> aliasOnTiers = blockManager.getStoreMeta().getAliasOnTiers(); long lastTierReservedBytes = 0; for (int idx = 0; idx < aliasOnTiers.size(); idx ++) { String tierReservedSpaceProp = String.format(Constants.WORKER_TIERED_STORE_LEVEL_RESERVED_RATIO_FORMAT, idx); int tierAlias = aliasOnTiers.get(idx); /** Similar to {@link BlockStoreMeta}, the alias index is the value of alias - 1 */ long reservedSpaceBytes = (long)(capOnTiers.get(tierAlias - 1) * WorkerContext.getConf() .getDouble(tierReservedSpaceProp)); mBytesToReserveOnTiers.add(new Pair<Integer, Long>(tierAlias, reservedSpaceBytes + lastTierReservedBytes)); lastTierReservedBytes += reservedSpaceBytes; } mCheckIntervalMs = WorkerContext.getConf().getInt(Constants.WORKER_TIERED_STORE_RESERVER_INTERVAL_MS); mRunning = true; }