Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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...
commit 5622b1116ce59ae318aa14a3608b9d2c267186d3 1 parent c96d631
authored September 09, 2011 dklayer committed October 18, 2011

Showing 1 changed file with 21 additions and 5 deletions. Show diff stats Hide diff stats

  1. 26  src/test/stress/Events.java
26  src/test/stress/Events.java
@@ -87,6 +87,8 @@
87 87
         
88 88
         // Time to run queries in minutes
89 89
         static private int QUERY_TIME = 10;
  90
+	// When non-zero perform QUERY_SIZE queries in query phases
  91
+	static private int QUERY_SIZE = 0;
90 92
         
91 93
         // Size of the Events
92 94
         static private int EVENT_SIZE = 50;
@@ -215,6 +217,10 @@ public static void init(String[] args) throws Exception {
215 217
                     .withArgName("MINUTES").hasArg()
216 218
                     .withDescription("time limit for query phase [default=" + QUERY_TIME + "]")
217 219
                     .create("t"));
  220
+            options.addOption(OptionBuilder.withLongOpt("query-size")
  221
+                    .withArgName("QUERY_SIZE").hasArg()
  222
+                    .withDescription("Total QUERY_EVENTS to perform in each query phase [default=" + QUERY_SIZE + "]")
  223
+                    .create());
218 224
             options.addOption(OptionBuilder.withLongOpt("event")
219 225
                     .withArgName("INTEGER").hasArg()
220 226
                     .withDescription("each event will contain number of triples [default=" + EVENT_SIZE + "]")
@@ -309,6 +315,7 @@ public static void init(String[] args) throws Exception {
309 315
             STATUS = cmdVal("status", STATUS);
310 316
             SIZE = Math.max(1000, test.Util.fromHumanInt( cmdVal("size", "" + SIZE) ));
311 317
             QUERY_TIME = cmdVal("time", QUERY_TIME);
  318
+            QUERY_SIZE = cmdVal("query-size", QUERY_SIZE);
312 319
             EVENT_SIZE = cmdVal("event", EVENT_SIZE);
313 320
             BULK_EVENTS = cmdVal("bulk", BULK_EVENTS);
314 321
             VERBOSE = cmdVal("verbose", VERBOSE, 1);
@@ -1022,7 +1029,12 @@ public QueryResult call() {
1022 1029
                     subcount = count;
1023 1030
                     
1024 1031
                     seconds = (end.getTimeInMillis() - startTime.getTimeInMillis()) / 1000.0;
1025  
-                    if (seconds > secondsToRun) {
  1032
+		    // stop after secondsToRun only if Defaults.QUERY_SIZE == 0
  1033
+		    // or if we've performed Defaults.QUERY_SIZE / Defaults.QUERY_WORKERS
  1034
+		    // queries.
  1035
+                    if ((Defaults.QUERY_SIZE == 0 && seconds > secondsToRun) ||
  1036
+			(Defaults.QUERY_SIZE > 0 && 
  1037
+			 queries >= Defaults.QUERY_SIZE / Defaults.QUERY_WORKERS)) {
1026 1038
                         break;
1027 1039
                     }
1028 1040
                 }
@@ -1458,8 +1470,10 @@ public void run(String[] args) throws Exception {
1458 1470
                 end = System.currentTimeMillis();
1459 1471
                 seconds = (end - start) / 1000.0;
1460 1472
 		trace("Phase 0 End: Initial query_workers took " + seconds + " seconds.");
1461  
-                trace("Phase 4 Begin: Perform SPARQL queries with %d processes for %d minutes.",
1462  
-                        Defaults.QUERY_WORKERS, Defaults.QUERY_TIME);
  1473
+                trace("Phase 4 Begin: Perform SPARQL queries with %d processes for %d %s.",
  1474
+		      Defaults.QUERY_WORKERS,
  1475
+		      Defaults.QUERY_SIZE == 0 ? Defaults.QUERY_TIME : Defaults.QUERY_SIZE,
  1476
+		      Defaults.QUERY_SIZE == 0 ? "minutes" : "queries");
1463 1477
                 Monitor.start(4);
1464 1478
                 int queries = 0;
1465 1479
                 long triples = 0;
@@ -1490,8 +1504,10 @@ public void run(String[] args) throws Exception {
1490 1504
 
1491 1505
                 closeAll(sparqlQueriers);
1492 1506
 
1493  
-                trace("Phase 5 Begin: Perform PROLOG queries with %d processes for %d minutes.",
1494  
-                        Defaults.QUERY_WORKERS, Defaults.QUERY_TIME);
  1507
+                trace("Phase 5 Begin: Perform SPARQL queries with %d processes for %d %s.",
  1508
+		      Defaults.QUERY_WORKERS,
  1509
+		      Defaults.QUERY_SIZE == 0 ? Defaults.QUERY_TIME : Defaults.QUERY_SIZE,
  1510
+		      Defaults.QUERY_SIZE == 0 ? "minutes" : "queries");
1495 1511
                 Monitor.start(5);
1496 1512
                 queries = 0;
1497 1513
                 triples = 0;

Git Notes

review

Code-Review+2: Ahmon Dancy <dancy@franz.com>
Verified+1: Kevin Layer <layer@franz.com>
Code-Review+1: John O'Rourke <jor@franz.com>
Submitted-by: Kevin Layer <layer@franz.com>
Submitted-at: Tue, 18 Oct 2011 15:59:24 -0700
Reviewed-on: https://gerrit.franz.com:9080/1644
Project: agraph-java-client
Branch: refs/heads/v4.4

0 notes on commit 5622b11

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