Class CachingBlockMasterClient

  • All Implemented Interfaces:
    alluxio.Client, java.io.Closeable, java.lang.AutoCloseable

    public class CachingBlockMasterClient
    extends alluxio.worker.block.BlockMasterClient
    Use this class to avoid the map-list conversion at the client side. This reduces the client side work so the time measurement for the whole RPC better reflects the time taken at the master side. Also reducing the workload on the client side will avoid the test becoming CPU-bound on the client side, when the concurrency is high.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  CachingBlockMasterClient.CachingBlockMapIterator
      Pre-generate the list so the RPC execution time does not include the conversion time.
      • Nested classes/interfaces inherited from class alluxio.AbstractClient

        alluxio.AbstractClient.RpcCallable<V extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      CachingBlockMasterClient.CachingBlockMapIterator mBlockBatchIterator  
      • Fields inherited from class alluxio.worker.block.BlockMasterClient

        mAsyncClient, mClient
      • Fields inherited from class alluxio.AbstractClient

        mAlwaysEnableTLS, mChannel, mClosed, mConnected, mContext, mServerAddress, mServiceVersion, mVersionService
    • Constructor Summary

      Constructors 
      Constructor Description
      CachingBlockMasterClient​(alluxio.master.MasterClientContext conf, java.util.List<alluxio.grpc.LocationBlockIdListEntry> locationBlockIdList)
      Creates a new instance and caches the converted proto.
      CachingBlockMasterClient​(alluxio.master.MasterClientContext conf, java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> blockMap)
      Creates a new instance and caches the converted proto.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<alluxio.grpc.LocationBlockIdListEntry> convertBlockListMapToProto​(java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> blockListOnLocation)  
      void registerWithStream​(long workerId, java.util.List<java.lang.String> storageTierAliases, java.util.Map<java.lang.String,​java.lang.Long> totalBytesOnTiers, java.util.Map<java.lang.String,​java.lang.Long> usedBytesOnTiers, java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> currentBlocksOnLocation, java.util.Map<java.lang.String,​java.util.List<java.lang.String>> lostStorage, java.util.List<alluxio.grpc.ConfigProperty> configList)  
      • Methods inherited from class alluxio.worker.block.BlockMasterClient

        acquireRegisterLeaseWithBackoff, afterConnect, commitBlock, commitBlockInUfs, getId, getRemoteServiceType, getServiceName, getServiceVersion, heartbeat, notifyWorkerId, register
      • Methods inherited from class alluxio.AbstractMasterClient

        afterDisconnect, beforeConnect, getConfAddress, queryGrpcServerAddress
      • Methods inherited from class alluxio.AbstractClient

        beforeDisconnect, checkVersion, close, connect, connectWithRuntimeException, disconnect, getRemoteHostName, getRemoteServiceVersion, getRemoteSockAddress, isClosed, isConnected, retryRPC, retryRPC
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachingBlockMasterClient

        public CachingBlockMasterClient​(alluxio.master.MasterClientContext conf,
                                        java.util.List<alluxio.grpc.LocationBlockIdListEntry> locationBlockIdList)
        Creates a new instance and caches the converted proto.
        Parameters:
        conf - master client configuration
        locationBlockIdList - location block id list
      • CachingBlockMasterClient

        public CachingBlockMasterClient​(alluxio.master.MasterClientContext conf,
                                        java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> blockMap)
        Creates a new instance and caches the converted proto.
        Parameters:
        conf - master client configuration
        blockMap - block lists of each location
    • Method Detail

      • convertBlockListMapToProto

        public java.util.List<alluxio.grpc.LocationBlockIdListEntry> convertBlockListMapToProto​(java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> blockListOnLocation)
        Overrides:
        convertBlockListMapToProto in class alluxio.worker.block.BlockMasterClient
      • registerWithStream

        public void registerWithStream​(long workerId,
                                       java.util.List<java.lang.String> storageTierAliases,
                                       java.util.Map<java.lang.String,​java.lang.Long> totalBytesOnTiers,
                                       java.util.Map<java.lang.String,​java.lang.Long> usedBytesOnTiers,
                                       java.util.Map<alluxio.worker.block.BlockStoreLocation,​java.util.List<java.lang.Long>> currentBlocksOnLocation,
                                       java.util.Map<java.lang.String,​java.util.List<java.lang.String>> lostStorage,
                                       java.util.List<alluxio.grpc.ConfigProperty> configList)
                                throws java.io.IOException
        Overrides:
        registerWithStream in class alluxio.worker.block.BlockMasterClient
        Throws:
        java.io.IOException