Skip to content

Commit

Permalink
Added new 'skew_factor' option to YCSB instead of always using hardco…
Browse files Browse the repository at this point in the history
…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 0ac50bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
3 changes: 3 additions & 0 deletions properties/benchmarks/ycsb.properties
Expand Up @@ -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
29 changes: 13 additions & 16 deletions src/benchmarks/edu/brown/benchmark/ycsb/YCSBClient.java
Expand Up @@ -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;

Expand All @@ -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()) {
Expand All @@ -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);

Expand All @@ -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>();
Expand Down
6 changes: 2 additions & 4 deletions src/benchmarks/edu/brown/benchmark/ycsb/YCSBLoader.java
Expand Up @@ -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()) {
Expand All @@ -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.");
Expand Down Expand Up @@ -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

Expand All @@ -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));
}
}
});
Expand Down

0 comments on commit 0ac50bd

Please sign in to comment.