HBASE-8235-Adding inmemory CF attribute to LoadTest and PerformanceEvaluation tool (Ram)

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1485779 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ramkrishna 2013-05-23 17:05:42 +00:00
parent 87a052f08d
commit 62e1137c94
2 changed files with 26 additions and 2 deletions

View File

@ -131,6 +131,7 @@ public class PerformanceEvaluation extends Configured implements Tool {
private DataBlockEncoding blockEncoding = DataBlockEncoding.NONE; private DataBlockEncoding blockEncoding = DataBlockEncoding.NONE;
private boolean flushCommits = true; private boolean flushCommits = true;
private boolean writeToWAL = true; private boolean writeToWAL = true;
private boolean inMemoryCF = false;
private int presplitRegions = 0; private int presplitRegions = 0;
private static final Path PERF_EVAL_DIR = new Path("performance_evaluation"); private static final Path PERF_EVAL_DIR = new Path("performance_evaluation");
@ -510,6 +511,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
HColumnDescriptor family = new HColumnDescriptor(FAMILY_NAME); HColumnDescriptor family = new HColumnDescriptor(FAMILY_NAME);
family.setDataBlockEncoding(blockEncoding); family.setDataBlockEncoding(blockEncoding);
family.setCompressionType(compression); family.setCompressionType(compression);
if (inMemoryCF) {
family.setInMemory(true);
}
TABLE_DESCRIPTOR.addFamily(family); TABLE_DESCRIPTOR.addFamily(family);
} }
return TABLE_DESCRIPTOR; return TABLE_DESCRIPTOR;
@ -1292,6 +1296,9 @@ public class PerformanceEvaluation extends Configured implements Tool {
System.err.println(" flushCommits Used to determine if the test should flush the table. Default: false"); System.err.println(" flushCommits Used to determine if the test should flush the table. Default: false");
System.err.println(" writeToWAL Set writeToWAL on puts. Default: True"); System.err.println(" writeToWAL Set writeToWAL on puts. Default: True");
System.err.println(" presplit Create presplit table. Recommended for accurate perf analysis (see guide). Default: disabled"); System.err.println(" presplit Create presplit table. Recommended for accurate perf analysis (see guide). Default: disabled");
System.err
.println(" inmemory Tries to keep the HFiles of the CF inmemory as far as possible. Not " +
"guaranteed that reads are always served from inmemory. Default: false");
System.err.println(); System.err.println();
System.err.println(" Note: -D properties will be applied to the conf used. "); System.err.println(" Note: -D properties will be applied to the conf used. ");
System.err.println(" For example: "); System.err.println(" For example: ");
@ -1396,7 +1403,13 @@ public class PerformanceEvaluation extends Configured implements Tool {
this.presplitRegions = Integer.parseInt(cmd.substring(presplit.length())); this.presplitRegions = Integer.parseInt(cmd.substring(presplit.length()));
continue; continue;
} }
final String inMemory = "--inmemory=";
if (cmd.startsWith(inMemory)) {
this.inMemoryCF = Boolean.parseBoolean(cmd.substring(inMemory.length()));
continue;
}
Class<? extends Test> cmdClass = determineCommandClass(cmd); Class<? extends Test> cmdClass = determineCommandClass(cmd);
if (cmdClass != null) { if (cmdClass != null) {
getArgs(i + 1, args); getArgs(i + 1, args);

View File

@ -86,6 +86,10 @@ public class LoadTestTool extends AbstractHBaseTool {
public static final String OPT_ENCODE_IN_CACHE_ONLY_USAGE = public static final String OPT_ENCODE_IN_CACHE_ONLY_USAGE =
"If this is specified, data blocks will only be encoded in block " + "If this is specified, data blocks will only be encoded in block " +
"cache but not on disk"; "cache but not on disk";
public static final String OPT_INMEMORY = "in_memory";
public static final String OPT_USAGE_IN_MEMORY = "Tries to keep the HFiles of the CF " +
"inmemory as far as possible. Not guaranteed that reads are always served from inmemory";
private static final String OPT_KEY_WINDOW = "key_window"; private static final String OPT_KEY_WINDOW = "key_window";
private static final String OPT_WRITE = "write"; private static final String OPT_WRITE = "write";
@ -116,7 +120,7 @@ public class LoadTestTool extends AbstractHBaseTool {
private boolean encodeInCacheOnly; private boolean encodeInCacheOnly;
private Compression.Algorithm compressAlgo; private Compression.Algorithm compressAlgo;
private BloomType bloomType; private BloomType bloomType;
private boolean inMemoryCF;
// Writer options // Writer options
private int numWriterThreads = DEFAULT_NUM_THREADS; private int numWriterThreads = DEFAULT_NUM_THREADS;
private int minColsPerKey, maxColsPerKey; private int minColsPerKey, maxColsPerKey;
@ -177,6 +181,9 @@ public class LoadTestTool extends AbstractHBaseTool {
columnDesc.setDataBlockEncoding(dataBlockEncodingAlgo); columnDesc.setDataBlockEncoding(dataBlockEncodingAlgo);
columnDesc.setEncodeOnDisk(!encodeInCacheOnly); columnDesc.setEncodeOnDisk(!encodeInCacheOnly);
} }
if (inMemoryCF) {
columnDesc.setInMemory(inMemoryCF);
}
if (isNewCf) { if (isNewCf) {
admin.addColumn(tableName, columnDesc); admin.addColumn(tableName, columnDesc);
} else { } else {
@ -208,6 +215,7 @@ public class LoadTestTool extends AbstractHBaseTool {
addOptNoArg(OPT_MULTIPUT, "Whether to use multi-puts as opposed to " + addOptNoArg(OPT_MULTIPUT, "Whether to use multi-puts as opposed to " +
"separate puts for every column in a row"); "separate puts for every column in a row");
addOptNoArg(OPT_ENCODE_IN_CACHE_ONLY, OPT_ENCODE_IN_CACHE_ONLY_USAGE); addOptNoArg(OPT_ENCODE_IN_CACHE_ONLY, OPT_ENCODE_IN_CACHE_ONLY_USAGE);
addOptNoArg(OPT_INMEMORY, OPT_USAGE_IN_MEMORY);
addOptWithArg(OPT_NUM_KEYS, "The number of keys to read/write"); addOptWithArg(OPT_NUM_KEYS, "The number of keys to read/write");
addOptWithArg(OPT_START_KEY, "The first key to read/write " + addOptWithArg(OPT_START_KEY, "The first key to read/write " +
@ -318,6 +326,9 @@ public class LoadTestTool extends AbstractHBaseTool {
String bloomStr = cmd.getOptionValue(OPT_BLOOM); String bloomStr = cmd.getOptionValue(OPT_BLOOM);
bloomType = bloomStr == null ? null : bloomType = bloomStr == null ? null :
BloomType.valueOf(bloomStr); BloomType.valueOf(bloomStr);
inMemoryCF = cmd.hasOption(OPT_INMEMORY);
} }
public void initTestTable() throws IOException { public void initTestTable() throws IOException {