org.apache.hadoop.hbase
Class HServerLoad

java.lang.Object
  extended by org.apache.hadoop.hbase.HServerLoad
All Implemented Interfaces:
Comparable<HServerLoad>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<HServerLoad>

public class HServerLoad
extends Object
implements org.apache.hadoop.io.WritableComparable<HServerLoad>

This class encapsulates metrics for determining the load on a HRegionServer


Nested Class Summary
static class HServerLoad.RegionLoad
          Encapsulates per-region loading metrics.
 
Constructor Summary
HServerLoad()
          default constructor (used by Writable)
HServerLoad(HServerLoad hsl)
          Constructor
HServerLoad(int numberOfRequests, int usedHeapMB, int maxHeapMB)
          Constructor
 
Method Summary
 void addRegionInfo(byte[] name, int stores, int storefiles, int storefileSizeMB, int memstoreSizeMB, int storefileIndexSizeMB)
          Deprecated. Use addRegionInfo(RegionLoad)
 void addRegionInfo(HServerLoad.RegionLoad load)
           
 int compareTo(HServerLoad o)
           
 boolean equals(Object o)
           
 int getLoad()
          Originally, this method factored in the effect of requests going to the server as well.
 int getMaxHeapMB()
           
 int getMemStoreSizeInMB()
           
 int getNumberOfRegions()
           
 int getNumberOfRequests()
           
 Collection<HServerLoad.RegionLoad> getRegionsLoad()
           
 int getStorefileIndexSizeInMB()
           
 int getStorefiles()
           
 int getStorefileSizeInMB()
           
 int getUsedHeapMB()
           
 int hashCode()
           
 void readFields(DataInput in)
           
 void setMaxHeapMB(int maxHeapMB)
           
 void setNumberOfRegions(int numberOfRegions)
           
 void setNumberOfRequests(int numberOfRequests)
           
 void setUsedHeapMB(int usedHeapMB)
           
 String toString()
           
 String toString(int msgInterval)
          Returns toString() with the number of requests divided by the message interval in seconds
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HServerLoad

public HServerLoad()
default constructor (used by Writable)


HServerLoad

public HServerLoad(int numberOfRequests,
                   int usedHeapMB,
                   int maxHeapMB)
Constructor

Parameters:
numberOfRequests -
usedHeapMB -
maxHeapMB -

HServerLoad

public HServerLoad(HServerLoad hsl)
Constructor

Parameters:
hsl - the template HServerLoad
Method Detail

getLoad

public int getLoad()
Originally, this method factored in the effect of requests going to the server as well. However, this does not interact very well with the current region rebalancing code, which only factors number of regions. For the interim, until we can figure out how to make rebalancing use all the info available, we're just going to make load purely the number of regions.

Returns:
load factor for this server

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

toString

public String toString(int msgInterval)
Returns toString() with the number of requests divided by the message interval in seconds

Parameters:
msgInterval -
Returns:
The load as a String

equals

public boolean equals(Object o)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

getNumberOfRegions

public int getNumberOfRegions()
Returns:
the numberOfRegions

getNumberOfRequests

public int getNumberOfRequests()
Returns:
the numberOfRequests

getUsedHeapMB

public int getUsedHeapMB()
Returns:
the amount of heap in use, in MB

getMaxHeapMB

public int getMaxHeapMB()
Returns:
the maximum allowable heap size, in MB

getRegionsLoad

public Collection<HServerLoad.RegionLoad> getRegionsLoad()
Returns:
region load metrics

getStorefiles

public int getStorefiles()
Returns:
Count of storefiles on this regionserver

getStorefileSizeInMB

public int getStorefileSizeInMB()
Returns:
Total size of store files in MB

getMemStoreSizeInMB

public int getMemStoreSizeInMB()
Returns:
Size of memstores in MB

getStorefileIndexSizeInMB

public int getStorefileIndexSizeInMB()
Returns:
Size of store file indexes in MB

setNumberOfRegions

public void setNumberOfRegions(int numberOfRegions)
Parameters:
numberOfRegions - the number of regions

setNumberOfRequests

public void setNumberOfRequests(int numberOfRequests)
Parameters:
numberOfRequests - the number of requests to set

setUsedHeapMB

public void setUsedHeapMB(int usedHeapMB)
Parameters:
usedHeapMB - the amount of heap in use, in MB

setMaxHeapMB

public void setMaxHeapMB(int maxHeapMB)
Parameters:
maxHeapMB - the maximum allowable heap size, in MB

addRegionInfo

public void addRegionInfo(HServerLoad.RegionLoad load)
Parameters:
load - Instance of HServerLoad

addRegionInfo

@Deprecated
public void addRegionInfo(byte[] name,
                                     int stores,
                                     int storefiles,
                                     int storefileSizeMB,
                                     int memstoreSizeMB,
                                     int storefileIndexSizeMB)
Deprecated. Use addRegionInfo(RegionLoad)

Parameters:
name -
stores -
storefiles -
memstoreSizeMB -
storefileIndexSizeMB -

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

compareTo

public int compareTo(HServerLoad o)
Specified by:
compareTo in interface Comparable<HServerLoad>


Copyright © 2011 The Apache Software Foundation. All Rights Reserved.