incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [40/47] git commit: Little test class
Date Mon, 03 Sep 2012 00:32:20 GMT
Little test class


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/e7f6a944
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/e7f6a944
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/e7f6a944

Branch: refs/heads/master
Commit: e7f6a9443eb5e2492597d398c4fa1d46ad355d8e
Parents: 23e362b
Author: gbarton <garrett.barton@gmail.com>
Authored: Fri Aug 3 17:48:14 2012 -0400
Committer: gbarton <garrett.barton@gmail.com>
Committed: Fri Aug 3 17:48:14 2012 -0400

----------------------------------------------------------------------
 .../blur/testsuite/CreateInsertQueryRepeating.java |   58 ++++++++++----
 .../blur/testsuite/LoadDataAsyncContinuously.java  |    2 +-
 2 files changed, 42 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e7f6a944/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java
----------------------------------------------------------------------
diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java
b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java
index 7e6b44c..7907dd3 100644
--- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java
+++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/CreateInsertQueryRepeating.java
@@ -15,6 +15,8 @@ import com.nearinfinity.blur.thrift.BlurClient;
 import com.nearinfinity.blur.thrift.generated.AnalyzerDefinition;
 import com.nearinfinity.blur.thrift.generated.Blur;
 import com.nearinfinity.blur.thrift.generated.Blur.AsyncClient.mutateBatch_call;
+import com.nearinfinity.blur.thrift.generated.Blur.AsyncClient.mutate_call;
+import com.nearinfinity.blur.thrift.generated.Blur.AsyncIface;
 import com.nearinfinity.blur.thrift.generated.Blur.Iface;
 import com.nearinfinity.blur.thrift.generated.BlurException;
 import com.nearinfinity.blur.thrift.generated.BlurQuery;
@@ -160,14 +162,18 @@ public class CreateInsertQueryRepeating {
 
 	private static void loadupTable(Iface client, String tableName, int rows)
 			throws BlurException, TException, IOException {
-		AsyncClientPool pool = new AsyncClientPool(10, 30000);
+		AsyncClientPool pool = new AsyncClientPool();//10, 30000);
+		AsyncIface poolClient = pool.getClient(Blur.AsyncIface.class, "localhost:40010");
 		
 		
 		long start = System.currentTimeMillis();
 		
 		List<RowMutation> mutates = new ArrayList<RowMutation>();
 		
+		long buildTotal = 0;
+		
 		for (int i = 1; i <= rows; i++) {
+			long buildStart = System.currentTimeMillis();
 			RowMutation mutation = new RowMutation();
 			mutation.table = tableName;
 			mutation.waitToBeVisible = true;
@@ -178,28 +184,46 @@ public class CreateInsertQueryRepeating {
 					newColumn("numberField", i + ""),
 					newColumn("fatTextField",randomString(1000))));
 			mutation.rowMutationType = RowMutationType.REPLACE_ROW;
-			mutates.add(mutation);
 			
-			if(mutates.size() == 10) {
-				pool.getClient(Blur.AsyncIface.class, "localhost:40010").mutateBatch(mutates,
-						new AsyncMethodCallback<Blur.AsyncClient.mutateBatch_call>() {
-						
+			if (i % 50 == 0) {
+				System.out.println("loaded: " + i + " around "
+						+ df.format((i / ((System.currentTimeMillis() - start+0.0)/1000) ))
+						+ " rows/s");
+				System.out.println("Total time: " + (System.currentTimeMillis()-start+0.0)/1000 +
+						" Build time: "  + ((buildTotal/1000)+0.0) + " " + buildTotal);
+			}			
+			
+			buildTotal += System.currentTimeMillis() - buildStart;
+//			mutates.add(mutation);
+
+			poolClient.mutate(mutation, 
+					new AsyncMethodCallback<Blur.AsyncClient.mutate_call>() {
+
 						@Override
-						public void onError(Exception exception) {	
-							exception.printStackTrace();
+						public void onComplete(mutate_call response) {
 						}
-						
+
 						@Override
-						public void onComplete(mutateBatch_call response) {
+						public void onError(Exception exception) {
+							exception.printStackTrace();
 						}
 					});
-				mutates.clear();
-			}
-			if (i % 50 == 0) {
-				System.out.println("loaded: " + i + " around "
-						+ df.format((i / ((System.currentTimeMillis() - start+0.0)/1000) ))
-						+ " rows/s");
-			}
+
+//			if(mutates.size() == 10) {
+//				pool.getClient(Blur.AsyncIface.class, "localhost:40010").mutateBatch(mutates,
+//						new AsyncMethodCallback<Blur.AsyncClient.mutateBatch_call>() {
+//						
+//						@Override
+//						public void onError(Exception exception) {	
+//							exception.printStackTrace();
+//						}
+//						
+//						@Override
+//						public void onComplete(mutateBatch_call response) {
+//						}
+//					});
+//				mutates.clear();
+//			}
 		}
 		System.out.println("loaded: " + rows + " around "
 				+ df.format((rows / ((System.currentTimeMillis() - start+0.0)/1000))) + " rows/s");

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/e7f6a944/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java
----------------------------------------------------------------------
diff --git a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java
b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java
index b4d4402..8e68486 100644
--- a/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java
+++ b/src/blur-testsuite/src/main/java/com/nearinfinity/blur/testsuite/LoadDataAsyncContinuously.java
@@ -40,7 +40,7 @@ public class LoadDataAsyncContinuously {
       int count = 0;
       int max = 1000;
       long start = System.currentTimeMillis();
-      final String table = "test_table";
+      final String table = "test1";
       AsyncClientPool pool = new AsyncClientPool();
       AsyncIface client = pool.getClient(Blur.AsyncIface.class, args[0]);
       for (int i = 0; i < numberRows; i++) {


Mime
View raw message