Search in sources :

Example 1 with MultiFilterOrderByOffsetPageSearcher

use of org.apache.jackrabbit.oak.scalability.benchmarks.search.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<Integer> coldSyncInterval = parser.accepts("coldSyncInterval", "interval between sync cycles in sec (Segment-Tar-Cold only)").withRequiredArg().ofType(Integer.class).defaultsTo(5);
    OptionSpec<Boolean> coldUseDataStore = parser.accepts("useDataStore", "Whether to use a datastore in the cold standby topology (Segment-Tar-Cold only)").withOptionalArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE);
    OptionSpec<Boolean> coldShareDataStore = parser.accepts("shareDataStore", "Whether to share the datastore for primary and standby in the cold standby topology (Segment-Tar-Cold only)").withOptionalArg().ofType(Boolean.class).defaultsTo(Boolean.FALSE);
    OptionSpec<Boolean> coldOneShotRun = parser.accepts("oneShotRun", "Whether to do a continuous sync between client and server or sync only once (Segment-Tar-Cold only)").withOptionalArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE);
    OptionSpec<Boolean> coldSecure = parser.accepts("secure", "Whether to enable secure communication between primary and standby in the cold standby topology (Segment-Tar-Cold only)").withOptionalArg().ofType(Boolean.class).defaultsTo(Boolean.FALSE);
    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.getSegmentTarWithDataStore(base.value(options), 256, cacheSize, mmap.value(options), fdsCache.value(options)), OakRepositoryFixture.getSegmentTarWithColdStandby(base.value(options), 256, cacheSize, mmap.value(options), coldUseDataStore.value(options), fdsCache.value(options), coldSyncInterval.value(options), coldShareDataStore.value(options), coldSecure.value(options), coldOneShotRun.value(options)), OakRepositoryFixture.getRDB(rdbjdbcuri.value(options), rdbjdbcuser.value(options), rdbjdbcpasswd.value(options), rdbjdbctableprefix.value(options), dropDBAfterTest.value(options), cacheSize * MB, -1), 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), -1) };
    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()), new ScalabilityStandbySuite().addBenchmarks(new StandbyBulkTransferBenchmark()) };
    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) MultiFilterOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByKeysetPageSearcher) SplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderByKeysetPageSearcher) OrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.OrderByKeysetPageSearcher) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByKeysetPageSearcher) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderBySearcher) MultiFilterOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByKeysetPageSearcher) LastModifiedSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.LastModifiedSearcher) FormatSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.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.search.ConcurrentWriter) SplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderByKeysetPageSearcher) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByKeysetPageSearcher) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderBySearcher) SplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderBySearcher) MultiFilterOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderBySearcher) OrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.OrderBySearcher) ScalabilityNodeSuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityNodeSuite) FullTextSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.FullTextSearcher) ConcurrentReader(org.apache.jackrabbit.oak.scalability.benchmarks.search.ConcurrentReader) OrderByDate(org.apache.jackrabbit.oak.scalability.benchmarks.search.OrderByDate) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByOffsetPageSearcher) SplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderByOffsetPageSearcher) File(java.io.File) MultiFilterOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderBySearcher) OptionParser(joptsimple.OptionParser) NodeTypeSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.NodeTypeSearcher) ScalabilityBlobSearchSuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityBlobSearchSuite) MultiFilterOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByOffsetPageSearcher) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByOffsetPageSearcher) OrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.OrderByOffsetPageSearcher) SplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderByOffsetPageSearcher) PrintStream(java.io.PrintStream) MultiFilterSplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderBySearcher) SplitOrderBySearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.SplitOrderBySearcher) MultiFilterSplitOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByOffsetPageSearcher) FacetSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.FacetSearcher) StandbyBulkTransferBenchmark(org.apache.jackrabbit.oak.scalability.benchmarks.segment.standby.StandbyBulkTransferBenchmark) MultiFilterSplitOrderByKeysetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterSplitOrderByKeysetPageSearcher) MultiFilterOrderByOffsetPageSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByOffsetPageSearcher) AggregateNodeSearcher(org.apache.jackrabbit.oak.scalability.benchmarks.search.AggregateNodeSearcher) ScalabilityStandbySuite(org.apache.jackrabbit.oak.scalability.suites.ScalabilityStandbySuite) 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 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.search.AggregateNodeSearcher)1 ConcurrentReader (org.apache.jackrabbit.oak.scalability.benchmarks.search.ConcurrentReader)1 ConcurrentWriter (org.apache.jackrabbit.oak.scalability.benchmarks.search.ConcurrentWriter)1 FacetSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.FacetSearcher)1 FormatSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.FormatSearcher)1 FullTextSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.FullTextSearcher)1 LastModifiedSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.LastModifiedSearcher)1 MultiFilterOrderByKeysetPageSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByKeysetPageSearcher)1 MultiFilterOrderByOffsetPageSearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderByOffsetPageSearcher)1 MultiFilterOrderBySearcher (org.apache.jackrabbit.oak.scalability.benchmarks.search.MultiFilterOrderBySearcher)1