public class CapacityBasedDeterministicHashPolicy extends Object implements BlockLocationPolicy
CapacityBaseRandomPolicy
is that this policy
uses the hashed block ID as the index to choose the target worker, so that the same block is
always routed to the same set of workers.
Both this policy and DeterministicHashPolicy
choose workers based the hashed block ID.
The difference is that DeterministicHashPolicy
uniformly distributes the blocks among
the configured number of shards, while this policy chooses workers based on a distribution of
their normalized capacity.CapacityBaseRandomPolicy
,
DeterministicHashPolicy
BlockLocationPolicy.Factory
Constructor and Description |
---|
CapacityBasedDeterministicHashPolicy(AlluxioConfiguration conf)
Constructor required by
BlockLocationPolicy.Factory.create(Class, AlluxioConfiguration) . |
Modifier and Type | Method and Description |
---|---|
protected BlockWorkerInfo |
getRandomCandidate(List<BlockWorkerInfo> candidates) |
Optional<WorkerNetAddress> |
getWorker(GetWorkerOptions options)
Gets the worker's network address for serving operations requested for the block.
|
protected long |
hashBlockId(long blockId) |
public CapacityBasedDeterministicHashPolicy(AlluxioConfiguration conf)
BlockLocationPolicy.Factory.create(Class, AlluxioConfiguration)
.conf
- Alluxio configurationpublic Optional<WorkerNetAddress> getWorker(GetWorkerOptions options)
BlockLocationPolicy
getWorker
in interface BlockLocationPolicy
options
- the options to get a block worker network address for a blockprotected long hashBlockId(long blockId)
protected BlockWorkerInfo getRandomCandidate(List<BlockWorkerInfo> candidates)
Copyright © 2023. All Rights Reserved.