Permalink
Browse files

rfe10902. Add query_size to run N queries during events test.

Adds a --query-size command-line argument to the events test,
which should be a non-negative integer. When specified, instead
of running each query phase for Defaults.QUERY_TIME minutes,
each QUERY_WORKER will run QUERY_SIZE / QUERY_WORKER queries.

Tests added for: none

Change-Id: I9403a680c1c8668a2792a18310736b5dbffb039c
Reviewed-on: https://gerrit.franz.com:9080/1644
Reviewed-by: John O'Rourke <jor@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information...
1 parent c96d631 commit 5622b1116ce59ae318aa14a3608b9d2c267186d3 Mikel Bancroft committed with dklayer Sep 10, 2011
Showing with 21 additions and 5 deletions.
  1. +21 −5 src/test/stress/Events.java
@@ -87,6 +87,8 @@
// Time to run queries in minutes
static private int QUERY_TIME = 10;
+ // When non-zero perform QUERY_SIZE queries in query phases
+ static private int QUERY_SIZE = 0;
// Size of the Events
static private int EVENT_SIZE = 50;
@@ -215,6 +217,10 @@ public static void init(String[] args) throws Exception {
.withArgName("MINUTES").hasArg()
.withDescription("time limit for query phase [default=" + QUERY_TIME + "]")
.create("t"));
+ options.addOption(OptionBuilder.withLongOpt("query-size")
+ .withArgName("QUERY_SIZE").hasArg()
+ .withDescription("Total QUERY_EVENTS to perform in each query phase [default=" + QUERY_SIZE + "]")
+ .create());
options.addOption(OptionBuilder.withLongOpt("event")
.withArgName("INTEGER").hasArg()
.withDescription("each event will contain number of triples [default=" + EVENT_SIZE + "]")
@@ -309,6 +315,7 @@ public static void init(String[] args) throws Exception {
STATUS = cmdVal("status", STATUS);
SIZE = Math.max(1000, test.Util.fromHumanInt( cmdVal("size", "" + SIZE) ));
QUERY_TIME = cmdVal("time", QUERY_TIME);
+ QUERY_SIZE = cmdVal("query-size", QUERY_SIZE);
EVENT_SIZE = cmdVal("event", EVENT_SIZE);
BULK_EVENTS = cmdVal("bulk", BULK_EVENTS);
VERBOSE = cmdVal("verbose", VERBOSE, 1);
@@ -1022,7 +1029,12 @@ public QueryResult call() {
subcount = count;
seconds = (end.getTimeInMillis() - startTime.getTimeInMillis()) / 1000.0;
- if (seconds > secondsToRun) {
+ // stop after secondsToRun only if Defaults.QUERY_SIZE == 0
+ // or if we've performed Defaults.QUERY_SIZE / Defaults.QUERY_WORKERS
+ // queries.
+ if ((Defaults.QUERY_SIZE == 0 && seconds > secondsToRun) ||
+ (Defaults.QUERY_SIZE > 0 &&
+ queries >= Defaults.QUERY_SIZE / Defaults.QUERY_WORKERS)) {
break;
}
}
@@ -1458,8 +1470,10 @@ public void run(String[] args) throws Exception {
end = System.currentTimeMillis();
seconds = (end - start) / 1000.0;
trace("Phase 0 End: Initial query_workers took " + seconds + " seconds.");
- trace("Phase 4 Begin: Perform SPARQL queries with %d processes for %d minutes.",
- Defaults.QUERY_WORKERS, Defaults.QUERY_TIME);
+ trace("Phase 4 Begin: Perform SPARQL queries with %d processes for %d %s.",
+ Defaults.QUERY_WORKERS,
+ Defaults.QUERY_SIZE == 0 ? Defaults.QUERY_TIME : Defaults.QUERY_SIZE,
+ Defaults.QUERY_SIZE == 0 ? "minutes" : "queries");
Monitor.start(4);
int queries = 0;
long triples = 0;
@@ -1490,8 +1504,10 @@ public void run(String[] args) throws Exception {
closeAll(sparqlQueriers);
- trace("Phase 5 Begin: Perform PROLOG queries with %d processes for %d minutes.",
- Defaults.QUERY_WORKERS, Defaults.QUERY_TIME);
+ trace("Phase 5 Begin: Perform SPARQL queries with %d processes for %d %s.",
+ Defaults.QUERY_WORKERS,
+ Defaults.QUERY_SIZE == 0 ? Defaults.QUERY_TIME : Defaults.QUERY_SIZE,
+ Defaults.QUERY_SIZE == 0 ? "minutes" : "queries");
Monitor.start(5);
queries = 0;
triples = 0;

0 comments on commit 5622b11

Please sign in to comment.