Skip to content
Browse files

updated version for hector and proj, added better large column count …

…support (per Cathy D. suggestions) updated schema
  • Loading branch information...
1 parent 7a53f8d commit fd2a981130d3c95e645eaba0fed658947211a94e zznate committed Jul 15, 2011
Showing with 25 additions and 18 deletions.
  1. +2 −2 pom.xml
  2. +20 −13 src/main/java/com/riptano/cassandra/stress/InsertCommand.java
  3. +3 −3 stress-schema.txt
View
4 pom.xml
@@ -4,7 +4,7 @@
<groupId>com.riptano.cassandra.stress</groupId>
<artifactId>cassandra-stress</artifactId>
- <version>0.7_28</version>
+ <version>0.8_1</version>
<packaging>jar</packaging>
<name>cassandra-stress</name>
@@ -108,7 +108,7 @@
<dependency>
<groupId>me.prettyprint</groupId>
<artifactId>hector-core</artifactId>
- <version>0.7.0-28</version>
+ <version>0.8.0-1</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
View
33 src/main/java/com/riptano/cassandra/stress/InsertCommand.java
@@ -41,26 +41,18 @@ public Void call() throws Exception {
key = String.format(KEY_FORMAT, rows+startKey);
for (int j2 = 0; j2 < commandArgs.columnCount; j2++) {
mutator.addInsertion(key, commandArgs.workingColumnFamily, HFactory.createStringColumn(String.format(COLUMN_NAME_FORMAT, j2),
- String.format(COLUMN_VAL_FORMAT, j2, RandomStringUtils.random(colWidth))));
+ String.format(COLUMN_VAL_FORMAT, j2, RandomStringUtils.random(colWidth))));
+ if ( j2 > 0 && j2 % commandArgs.batchSize == 0 ) {
+ executeMutator(rows);
+ }
}
if (++rows == commandArgs.getKeysPerThread() ) {
break;
}
}
- try {
- MutationResult mr = mutator.execute();
- LatencyTracker writeCount = commandRunner.latencies.get(mr.getHostUsed());
- if ( writeCount != null )
- writeCount.addMicro(mr.getExecutionTimeMicro());
- mutator.discardPendingMutations();
-
- log.info("executed batch of {}. {} of {} complete", new Object[]{commandArgs.batchSize, rows, commandArgs.getKeysPerThread()});
-
- } catch (Exception ex){
- log.error("Problem executing insert:",ex);
- }
+ executeMutator(rows);
}
commandRunner.doneSignal.countDown();
log.info("Last key was: {} for thread {}", key, Thread.currentThread().getId());
@@ -73,6 +65,21 @@ public Void call() throws Exception {
log.info("Executed chunk of {}. Latch now at {}", commandArgs.getKeysPerThread(), commandRunner.doneSignal.getCount());
return null;
}
+
+ private void executeMutator(int rows) {
+ try {
+ MutationResult mr = mutator.execute();
+ LatencyTracker writeCount = commandRunner.latencies.get(mr.getHostUsed());
+ if ( writeCount != null )
+ writeCount.addMicro(mr.getExecutionTimeMicro());
+ mutator.discardPendingMutations();
+
+ log.info("executed batch of {}. {} of {} complete", new Object[]{commandArgs.batchSize, rows, commandArgs.getKeysPerThread()});
+
+ } catch (Exception ex){
+ log.error("Problem executing insert:",ex);
+ }
+ }
private static final String COLUMN_VAL_FORMAT = "%08d_%s";
private static final String COLUMN_NAME_FORMAT = "col_%08d";
View
6 stress-schema.txt
@@ -1,6 +1,6 @@
-create keyspace StressKeyspace
- with replication_factor = 1
- and placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy';
+create keyspace StressKeyspace
+ with placement_strategy = 'SimpleStrategy'
+ and strategy_options = [{replication_factor : 1}];
use StressKeyspace;
drop column family StressStandard;

0 comments on commit fd2a981

Please sign in to comment.
Something went wrong with that request. Please try again.