Permalink
Browse files

initial checkin

  • Loading branch information...
1 parent b22ddb8 commit 31c0028333563156175c1409369947c521c54a0f @javasoze committed Feb 26, 2010
Showing 365 changed files with 182,045 additions and 0 deletions.
View
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="bobo-bench/src"/>
+ <classpathentry kind="src" path="bobo-demo/src"/>
+ <classpathentry kind="src" path="bobo-gwt/src"/>
+ <classpathentry kind="src" path="bobo-perf/src"/>
+ <classpathentry kind="src" path="bobo-tools/src"/>
+ <classpathentry kind="src" path="bobo-solr/src"/>
+ <classpathentry kind="src" path="bobo-browse/src"/>
+ <classpathentry kind="src" path="bobo-service/src"/>
+ <classpathentry kind="src" path="test/src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/master/commons-cli.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-collections.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-digester.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-httpclient.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-logging.jar"/>
+ <classpathentry kind="lib" path="lib/master/dwr.jar"/>
+ <classpathentry kind="lib" path="lib/master/fastutil.jar"/>
+ <classpathentry kind="lib" path="lib/master/json.jar"/>
+ <classpathentry kind="lib" path="lib/master/log4j.jar"/>
+ <classpathentry kind="lib" path="lib/master/lucene-highlighter.jar"/>
+ <classpathentry kind="lib" path="lib/master/servlet-api.jar"/>
+ <classpathentry kind="lib" path="lib/master/spring-webmvc.jar"/>
+ <classpathentry kind="lib" path="lib/master/spring.jar"/>
+ <classpathentry kind="lib" path="lib/master/xercesImpl.jar"/>
+ <classpathentry kind="lib" path="lib/master/xmlParserAPIs.jar"/>
+ <classpathentry kind="lib" path="lib/master/xstream.jar"/>
+ <classpathentry kind="lib" path="lib/test/junit.jar"/>
+ <classpathentry kind="lib" path="lib/master/protobuf-java-2.2.0.jar"/>
+ <classpathentry kind="lib" path="lib/master/lucene-core.jar"/>
+ <classpathentry kind="lib" path="lib/master/kamikaze-2.0.0.jar"/>
+ <classpathentry kind="lib" path="lib/master/zoie-2.0.0-rc1.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-configuration.jar"/>
+ <classpathentry kind="lib" path="lib/master/commons-lang.jar"/>
+ <classpathentry kind="lib" path="lib/solr/solr-core.jar"/>
+ <classpathentry kind="lib" path="lib/solr/solr-solrj.jar"/>
+ <classpathentry kind="lib" path="lib/gui/gwt-user.jar"/>
+ <classpathentry kind="lib" path="lib/gui/gwt-visualization.jar"/>
+ <classpathentry kind="lib" path="lib/master/ant.jar"/>
+ <classpathentry kind="output" path="output"/>
+</classpath>
View
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>bobo-perf-improvement</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
@@ -0,0 +1,19 @@
+grinder.test0.description = "Bobo query test"
+grinder.test0.sleepTime = 500
+grinder.recordTime = true
+grinder.threads=30
+grinder.cycles = 100000
+grinder.processes = 1
+
+grinder.reportToConsole=true
+grinder.receiveConsoleSignals=true
+
+grinder.plugin=com.browseengine.bobo.bench.BoboPlugin
+grinder.plugin.parameter.host = 127.0.0.1
+grinder.plugin.parameter.port = 9999
+grinder.plugin.parameter.path = /democar/bobo/
+grinder.plugin.parameter.timeout=0
+grinder.plugin.parameter.querylog = logs/qlog.log
+
+grinder.initialSleepTime = 10
+grinder.sleepTimeFactor = 1
View
@@ -0,0 +1,47 @@
+<project name="bobo-bench" default="dist">
+ <property name="src" value="src"/>
+ <property name="lib" value="${bobo.root}/lib"/>
+ <property name="build" value="build"/>
+
+ <!-- <property name="resource" value="${bobo.root}/resource"/>
+ -->
+
+ <path id="project.class.path">
+ <fileset dir="${lib}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${dist}">
+ <include name="${bobo-browse}.jar"/>
+ </fileset>
+ <fileset dir="${dist}">
+ <include name="${bobo-server}.jar"/>
+ </fileset>
+ <!-- <fileset dir="${resource}">
+ <include name="*.jar"/>
+ </fileset>-->
+ </path>
+
+ <target name="clean">
+ <delete dir="${build}"/>
+ <delete dir="${dist}"/>
+ </target>
+
+ <target name="init">
+ <mkdir dir="${build}"/>
+ <!-- <mkdir dir="${dist}"/>-->
+ </target>
+
+ <target name="compile" depends="init">
+ <javac debug="true" optimize="false" destdir="${build}">
+ <src path="${src}"/>
+ <classpath refid="project.class.path"/>
+ </javac>
+ </target>
+
+ <target name="dist" depends="compile">
+<!-- <copy file="${resource}/log4j.properties" todir="${build}"/>
+-->
+ <jar destfile="${dist}/${bobo-bench}.jar" basedir="${build}" />
+ <delete dir="${build}" />
+ </target>
+</project>
@@ -0,0 +1,164 @@
+package com.browseengine.bobo.bench;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
+
+import com.browseengine.bobo.api.Browsable;
+import com.browseengine.bobo.api.BrowseRequest;
+import com.browseengine.bobo.api.BrowseResult;
+import com.browseengine.bobo.api.BrowseSelection;
+import com.browseengine.bobo.api.FacetSpec;
+import com.browseengine.bobo.api.FacetSpec.FacetSortSpec;
+
+public class BoboClient
+{
+
+ private static class RequestBuilder
+ {
+ private final File _reqFile;
+ RequestBuilder(File reqFile)
+ {
+ _reqFile = reqFile;
+ }
+
+ public BrowseRequest[] buildRequests() throws IOException
+ {
+ List<BrowseRequest> reqList = new LinkedList<BrowseRequest>();
+ FileInputStream fin = new FileInputStream(_reqFile);
+ BufferedReader reader = new BufferedReader(new InputStreamReader(fin,"UTF-8"));
+ String line = reader.readLine();
+ String[] facets = line.split(",");
+
+ while(true)
+ {
+ line = reader.readLine();
+ if (line==null) break;
+ if (line.startsWith("//")) continue;
+ String[] parts1 = line.split(":");
+ if(parts1.length==2)
+ {
+ String[] parts2 = parts1[1].split(",");
+ if (parts2.length>0)
+ {
+ BrowseSelection sel = new BrowseSelection(parts1[0]);
+ sel.setValues(parts2);
+ BrowseRequest req = new BrowseRequest();
+ req.addSelection(sel);
+ for (String facet : facets)
+ {
+ FacetSpec fspec = new FacetSpec();
+ fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);
+ fspec.setMaxCount(10);
+ req.setFacetSpec(facet, fspec);
+ }
+ reqList.add(req);
+ }
+ }
+ }
+ reader.close();
+ return reqList.toArray(new BrowseRequest[reqList.size()]);
+ }
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception
+ {
+ File dataFile = new File("/Users/jwang/proj/bobo-trunk/cardata/facetvals.txt");
+ RequestBuilder reqBuilder = new RequestBuilder(dataFile);
+ final BrowseRequest[] reqs = reqBuilder.buildRequests();
+
+ final HttpInvokerProxyFactoryBean factoryBean = new HttpInvokerProxyFactoryBean();
+
+ factoryBean.setServiceInterface(Browsable.class);
+ factoryBean.setServiceUrl("http://localhost:8888/bobo-service/services/BrowseService");
+ factoryBean.afterPropertiesSet();
+
+ final Browsable svc = (Browsable) (factoryBean.getObject());
+
+ int numThreads = 1;
+
+ Thread[] threads = new Thread[numThreads];
+ for (int i = 0; i < threads.length; ++i)
+ {
+ threads[i] = new Thread()
+ {
+ public void run()
+ {
+ for (BrowseRequest req : reqs)
+ {
+ try
+ {
+ long start = System.currentTimeMillis();
+ BrowseResult result = svc.browse(req);
+ long end = System.currentTimeMillis();
+
+ long time = result.getTime();
+ System.out.println("took: (c):" + (end - start) + " / (s):" + time);
+ Thread.sleep(200);
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ public void run2()
+ {
+ while (true)
+ {
+ try
+ {
+ BrowseRequest req = new BrowseRequest();
+ BrowseSelection sel = new BrowseSelection("color");
+ sel.addValue("red");
+ req.addSelection(sel);
+
+ FacetSpec fspec = new FacetSpec();
+ fspec.setExpandSelection(true);
+ fspec.setMaxCount(10);
+ fspec.setOrderBy(FacetSortSpec.OrderHitsDesc);
+
+ req.setFacetSpec("color", fspec);
+ req.setFacetSpec("category", fspec);
+ req.setFacetSpec("makemodel", fspec);
+ req.setFacetSpec("city", fspec);
+ req.setFacetSpec("price", fspec);
+ req.setFacetSpec("year", fspec);
+
+ long start = System.currentTimeMillis();
+ BrowseResult result = svc.browse(req);
+ long end = System.currentTimeMillis();
+
+ long time = result.getTime();
+ System.out.println("took: (c):" + (end - start) + " / (s):" + time);
+ Thread.sleep(200);
+ }
+ catch (Exception e)
+ {
+ System.out.println("error: " + e.getMessage());
+ }
+ }
+ }
+ };
+ }
+
+ for (Thread t : threads)
+ {
+ t.start();
+ }
+ for (Thread t : threads)
+ {
+ t.join();
+ }
+ }
+
+}
Oops, something went wrong.

0 comments on commit 31c0028

Please sign in to comment.