Search in sources :

Example 1 with MultiFilterOrderByOffsetPageSearcher

use of org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByOffsetPageSearcher in project jackrabbit-oak by apache.

the class ScalabilityRunner method main.

public static void main(String[] args) throws Exception {
    OptionParser parser = new OptionParser();
    OptionSpec<File> base = parser.accepts("base", "Base directory").withRequiredArg().ofType(File.class).defaultsTo(new File("target"));
    OptionSpec<String> host = parser.accepts("host", "MongoDB host").withRequiredArg().defaultsTo("localhost");
    OptionSpec<Integer> port = parser.accepts("port", "MongoDB port").withRequiredArg().ofType(Integer.class).defaultsTo(27017);
    OptionSpec<String> dbName = parser.accepts("db", "MongoDB database").withRequiredArg();
    OptionSpec<Boolean> dropDBAfterTest = parser.accepts("dropDBAfterTest", "Whether to drop the MongoDB database after the test").withOptionalArg().ofType(Boolean.class).defaultsTo(true);
    OptionSpec<String> rdbjdbcuri = parser.accepts("rdbjdbcuri", "RDB JDBC URI").withOptionalArg().defaultsTo("jdbc:h2:./target/benchmark");
    OptionSpec<String> rdbjdbcuser = parser.accepts("rdbjdbcuser", "RDB JDBC user").withOptionalArg().defaultsTo("");
    OptionSpec<String> rdbjdbcpasswd = parser.accepts("rdbjdbcpasswd", "RDB JDBC password").withOptionalArg().defaultsTo("");
    OptionSpec<String> rdbjdbctableprefix = parser.accepts("rdbjdbctableprefix", "RDB JDBC table prefix").withOptionalArg().defaultsTo("");
    OptionSpec<Boolean> mmap = parser.accepts("mmap", "TarMK memory mapping").withOptionalArg().ofType(Boolean.class).defaultsTo("64".equals(System.getProperty("sun.arch.data.model")));
    OptionSpec<Integer> cache = parser.accepts("cache", "cache size (MB)").withRequiredArg().ofType(Integer.class).defaultsTo(100);
    OptionSpec<Integer> fdsCache = parser.accepts("blobCache", "cache size (MB)").withRequiredArg().ofType(Integer.class).defaultsTo(32);
    OptionSpec<Boolean> withStorage = parser.accepts("storage", "Index storage enabled").withOptionalArg().ofType(Boolean.class);
    OptionSpec<File> csvFile = parser.accepts("csvFile", "File to write a CSV version of the benchmark data.").withOptionalArg().ofType(File.class);
    OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp();
    OptionSpec<String> nonOption = parser.nonOptions();
    OptionSet options = parser.parse(args);
    if (options.has(help)) {
        parser.printHelpOn(System.out);
        System.exit(0);
    }
    int cacheSize = cache.value(options);
    RepositoryFixture[] allFixtures = new RepositoryFixture[] { new JackrabbitRepositoryFixture(base.value(options), cacheSize), OakRepositoryFixture.getMemoryNS(cacheSize * MB), OakRepositoryFixture.getMongo(host.value(options), port.value(options), dbName.value(options), dropDBAfterTest.value(options), cacheSize * MB), OakRepositoryFixture.getMongoWithDS(host.value(options), port.value(options), dbName.value(options), dropDBAfterTest.value(options), cacheSize * MB, base.value(options), fdsCache.value(options)), OakRepositoryFixture.getMongoNS(host.value(options), port.value(options), dbName.value(options), dropDBAfterTest.value(options), cacheSize * MB), OakRepositoryFixture.getSegmentTar(base.value(options), 256, cacheSize, mmap.value(options)), OakRepositoryFixture.getSegmentTarWithBlobStore(base.value(options), 256, cacheSize, mmap.value(options), fdsCache.value(options)), OakRepositoryFixture.getRDB(rdbjdbcuri.value(options), rdbjdbcuser.value(options), rdbjdbcpasswd.value(options), rdbjdbctableprefix.value(options), dropDBAfterTest.value(options), cacheSize * MB), OakRepositoryFixture.getRDBWithDS(rdbjdbcuri.value(options), rdbjdbcuser.value(options), rdbjdbcpasswd.value(options), rdbjdbctableprefix.value(options), dropDBAfterTest.value(options), cacheSize * MB, base.value(options), fdsCache.value(options)) };
    ScalabilitySuite[] allSuites = new ScalabilitySuite[] { new ScalabilityBlobSearchSuite(withStorage.value(options)).addBenchmarks(new FullTextSearcher(), new NodeTypeSearcher(), new FormatSearcher(), new FacetSearcher(), new LastModifiedSearcher(Date.LAST_2_HRS), new LastModifiedSearcher(Date.LAST_24_HRS), new LastModifiedSearcher(Date.LAST_7_DAYS), new LastModifiedSearcher(Date.LAST_MONTH), new LastModifiedSearcher(Date.LAST_YEAR), new OrderByDate()), new ScalabilityNodeSuite(withStorage.value(options)).addBenchmarks(new OrderBySearcher(), new SplitOrderBySearcher(), new OrderByOffsetPageSearcher(), new SplitOrderByOffsetPageSearcher(), new OrderByKeysetPageSearcher(), new SplitOrderByKeysetPageSearcher(), new MultiFilterOrderBySearcher(), new MultiFilterSplitOrderBySearcher(), new MultiFilterOrderByOffsetPageSearcher(), new MultiFilterSplitOrderByOffsetPageSearcher(), new MultiFilterOrderByKeysetPageSearcher(), new MultiFilterSplitOrderByKeysetPageSearcher(), new ConcurrentReader(), new ConcurrentWriter()), new ScalabilityNodeRelationshipSuite(withStorage.value(options)).addBenchmarks(new AggregateNodeSearcher()) };
    Set<String> argset = Sets.newHashSet(nonOption.values(options));
    List<RepositoryFixture> fixtures = Lists.newArrayList();
    for (RepositoryFixture fixture : allFixtures) {
        if (argset.remove(fixture.toString())) {
            fixtures.add(fixture);
        }
    }
    Map<String, List<String>> argmap = Maps.newHashMap();
    // Split the args to get suites and benchmarks (i.e. suite:benchmark1,benchmark2)
    for (String arg : argset) {
        List<String> tokens = Splitter.on(":").limit(2).splitToList(arg);
        if (tokens.size() > 1) {
            argmap.put(tokens.get(0), Splitter.on(",").trimResults().splitToList(tokens.get(1)));
        } else {
            argmap.put(tokens.get(0), null);
        }
        argset.remove(arg);
    }
    if (argmap.isEmpty()) {
        System.err.println("Warning: no scalability suites specified, " + "supported  are: " + Arrays.asList(allSuites));
    }
    List<ScalabilitySuite> suites = Lists.newArrayList();
    for (ScalabilitySuite suite : allSuites) {
        if (argmap.containsKey(suite.toString())) {
            List<String> benchmarks = argmap.get(suite.toString());
            // Only keep requested benchmarks
            if (benchmarks != null) {
                Iterator<String> iter = suite.getBenchmarks().keySet().iterator();
                for (; iter.hasNext(); ) {
                    String availBenchmark = iter.next();
                    if (!benchmarks.contains(availBenchmark)) {
                        iter.remove();
                    }
                }
            }
            suites.add(suite);
            argmap.remove(suite.toString());
        }
    }
    if (argmap.isEmpty()) {
        PrintStream out = null;
        if (options.has(csvFile)) {
            out = new PrintStream(FileUtils.openOutputStream(csvFile.value(options), true), false, Charsets.UTF_8.name());
        }
        for (ScalabilitySuite suite : suites) {
            if (suite instanceof CSVResultGenerator) {
                ((CSVResultGenerator) suite).setPrintStream(out);
            }
            suite.run(fixtures);
        }
        if (out != null) {
            out.close();
        }
    } else {
        System.err.println("Unknown arguments: " + argset);
    }
}
Also used : JackrabbitRepositoryFixture(org.apache.jackrabbit.oak.fixture.JackrabbitRepositoryFixture) SplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderByKeysetPageSearcher) MultiFilterOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByKeysetPageSearcher) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByKeysetPageSearcher) OrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.OrderByKeysetPageSearcher) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderBySearcher) MultiFilterOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByKeysetPageSearcher) LastModifiedSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.LastModifiedSearcher) FormatSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.FormatSearcher) JackrabbitRepositoryFixture(org.apache.jackrabbit.oak.fixture.JackrabbitRepositoryFixture) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) RepositoryFixture(org.apache.jackrabbit.oak.fixture.RepositoryFixture) CSVResultGenerator(org.apache.jackrabbit.oak.benchmark.CSVResultGenerator) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ScalabilityNodeRelationshipSuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityNodeRelationshipSuite) ConcurrentWriter(org.apache.jackrabbit.oak.scalability.benchmarks.ConcurrentWriter) SplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderByKeysetPageSearcher) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByKeysetPageSearcher) OrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.OrderBySearcher) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderBySearcher) MultiFilterOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderBySearcher) SplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderBySearcher) ScalabilityNodeSuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityNodeSuite) FullTextSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.FullTextSearcher) ConcurrentReader(org.apache.jackrabbit.oak.scalability.benchmarks.ConcurrentReader) OrderByDate(org.apache.jackrabbit.oak.scalability.benchmarks.OrderByDate) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByOffsetPageSearcher) SplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderByOffsetPageSearcher) File(java.io.File) OptionSpec(joptsimple.OptionSpec) MultiFilterOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderBySearcher) OptionParser(joptsimple.OptionParser) NodeTypeSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.NodeTypeSearcher) ScalabilityBlobSearchSuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityBlobSearchSuite) MultiFilterOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByOffsetPageSearcher) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByOffsetPageSearcher) OrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.OrderByOffsetPageSearcher) SplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderByOffsetPageSearcher) PrintStream(java.io.PrintStream) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderBySearcher) SplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.SplitOrderBySearcher) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByOffsetPageSearcher) FacetSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.FacetSearcher) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterSplitOrderByKeysetPageSearcher) MultiFilterOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByOffsetPageSearcher) AggregateNodeSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.AggregateNodeSearcher) OptionSet(joptsimple.OptionSet)

Aggregations

File (java.io.File)1 PrintStream (java.io.PrintStream)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 OptionParser (joptsimple.OptionParser)1 OptionSet (joptsimple.OptionSet)1 OptionSpec (joptsimple.OptionSpec)1 CSVResultGenerator (org.apache.jackrabbit.oak.benchmark.CSVResultGenerator)1 JackrabbitRepositoryFixture (org.apache.jackrabbit.oak.fixture.JackrabbitRepositoryFixture)1 OakRepositoryFixture (org.apache.jackrabbit.oak.fixture.OakRepositoryFixture)1 RepositoryFixture (org.apache.jackrabbit.oak.fixture.RepositoryFixture)1 AggregateNodeSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.AggregateNodeSearcher)1 ConcurrentReader (org.apache.jackrabbit.oak.scalability.benchmarks.ConcurrentReader)1 ConcurrentWriter (org.apache.jackrabbit.oak.scalability.benchmarks.ConcurrentWriter)1 FacetSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.FacetSearcher)1 FormatSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.FormatSearcher)1 FullTextSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.FullTextSearcher)1 LastModifiedSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.LastModifiedSearcher)1 MultiFilterOrderByKeysetPageSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByKeysetPageSearcher)1 MultiFilterOrderByOffsetPageSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.MultiFilterOrderByOffsetPageSearcher)1