Permalink
Browse files

Added new 'skew_factor' option to YCSB instead of always using hardco…

…ded value. Cleaned up YCSBClient so that it uses the correct number of records in its calculation
  • Loading branch information...
apavlo committed Nov 18, 2013
1 parent 5668245 commit 0ac50bd06103c10b4ef392186c62ab5850845653
@@ -8,3 +8,6 @@ builder = edu.brown.benchmark.ycsb.YCSBProjectBuilder
# only add the number of tuples defined in 'num_records'
fixed_size = false
num_records = 100000
# Zipfian skew factor for tuple access
skew_factor = 0.5
@@ -89,6 +89,7 @@ private Transaction(String displayName, int weight) {
private final ZipfianGenerator randScan;
private final FlatHistogram<Transaction> txnWeights;
private final Random rand_gen;
private double skewFactor = YCSBConstants.ZIPFIAN_CONSTANT;
int run_count = 0;
@@ -101,7 +102,6 @@ public static void main(String args[]) {
public YCSBClient(String args[]) {
super(args);
final CatalogContext catalogContext = this.getCatalogContext();
boolean useFixedSize = false;
long fixedSize = -1;
for (String key : m_extraParams.keySet()) {
@@ -116,22 +116,19 @@ public YCSBClient(String args[]) {
else if (key.equalsIgnoreCase("num_records")) {
fixedSize = Long.valueOf(value);
}
// Zipfian Skew Factor
else if (key.equalsIgnoreCase("skew_factor")) {
this.skewFactor = Double.valueOf(value);
}
} // FOR
// Figure out the # of records that we need
// if (useFixedSize && fixedSize > 0) {
// this.init_record_count = fixedSize;
// }
// else {
// //this.init_record_count = (int)Math.round(YCSBConstants.NUM_RECORDS *
//// catalogContext.numberOfPartitions *
//// this.getScaleFactor());
//
// this.init_record_count = YCSBConstants.NUM_RECORDS;
// }
this.init_record_count = YCSBConstants.NUM_RECORDS;
if (useFixedSize && fixedSize > 0) {
this.init_record_count = fixedSize;
}
else {
this.init_record_count = (long)Math.round(YCSBConstants.NUM_RECORDS * this.getScaleFactor());
}
this.rand_gen = new Random();
this.randScan = new ZipfianGenerator(YCSBConstants.MAX_SCAN);
@@ -145,8 +142,8 @@ else if (key.equalsIgnoreCase("num_records")) {
// YCSBConstants.HOT_DATA_WORKLOAD_SKEW, YCSBConstants.HOT_DATA_SIZE,
// YCSBConstants.WARM_DATA_WORKLOAD_SKEW, YCSBConstants.WARM_DATA_SIZE);
this.insertRecord = new ZipfianGenerator(YCSBConstants.NUM_RECORDS, YCSBConstants.ZIPFIAN_CONSTANT);
this.readRecord = new ZipfianGenerator(YCSBConstants.NUM_RECORDS, YCSBConstants.ZIPFIAN_CONSTANT);
this.insertRecord = new ZipfianGenerator(this.init_record_count, this.skewFactor);
this.readRecord = new ZipfianGenerator(this.init_record_count, this.skewFactor);
// Initialize the sampling table
Histogram<Transaction> txns = new ObjectHistogram<Transaction>();
@@ -71,7 +71,6 @@ public YCSBLoader(String[] args) {
if (debug.val)
LOG.debug("CONSTRUCTOR: " + YCSBLoader.class.getName());
final CatalogContext catalogContext = this.getCatalogContext();
boolean useFixedSize = false;
long fixedSize = -1;
for (String key : m_extraParams.keySet()) {
@@ -98,7 +97,6 @@ else if (key.equalsIgnoreCase("loadthreads")) {
}
else {
this.init_record_count = (int)Math.round(YCSBConstants.NUM_RECORDS *
catalogContext.numberOfPartitions *
this.getScaleFactor());
}
LOG.info("Initializing database with " + init_record_count + " records.");
@@ -144,7 +142,7 @@ public void run() {
table.clearRowData();
if (debug.val)
LOG.debug(String.format("[%d] Records Loaded: %6d / %d",
thread_id, total.get(), YCSBConstants.NUM_RECORDS));
thread_id, total.get(), init_record_count));
}
} // FOR
@@ -155,7 +153,7 @@ public void run() {
table.clearRowData();
if (debug.val)
LOG.debug(String.format("[%d] Records Loaded: %6d / %d",
thread_id, total.get(), YCSBConstants.NUM_RECORDS));
thread_id, total.get(), init_record_count));
}
}
});

0 comments on commit 0ac50bd

Please sign in to comment.