Skip to content

Commit

Permalink
rfe10902. Add query_size to run N queries during events test.
Browse files Browse the repository at this point in the history
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
Mikel Bancroft authored and dklayer committed Oct 18, 2011
1 parent c96d631 commit 5622b11
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/test/stress/Events.java
Expand Up @@ -87,6 +87,8 @@ static class Defaults {

// 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;
Expand Down Expand Up @@ -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 + "]")
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 5622b11

Please sign in to comment.