diff --git oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java index 5d5a8522f2..bc7b3d513d 100644 --- oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java +++ oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/benchmark/BenchmarkRunner.java @@ -178,10 +178,20 @@ public class BenchmarkRunner { "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 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 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 verbose = parser.accepts("verbose", "Enable verbose output"); OptionSpec nonOption = parser.nonOptions(); - OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp(); + OptionSpec help = parser.acceptsAll(asList("h", "?", "help"), "show help").forHelp(); OptionSet options = parser.parse(args); if(options.has(help)){ @@ -218,7 +228,8 @@ public class BenchmarkRunner { 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)), + 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, vgcMaxAge.value(options)), diff --git oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/scalability/ScalabilityRunner.java oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/scalability/ScalabilityRunner.java index fd5577739f..5d7cc2493d 100644 --- oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/scalability/ScalabilityRunner.java +++ oak-benchmarks/src/main/java/org/apache/jackrabbit/oak/scalability/ScalabilityRunner.java @@ -113,7 +113,30 @@ public class ScalabilityRunner { OptionSpec 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 coldSyncInterval = parser.accepts("coldSyncInterval", "interval between sync cycles in sec (Segment-Tar-Cold only)") + .withRequiredArg().ofType(Integer.class).defaultsTo(5); + OptionSpec 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 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 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 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 nonOption = parser.nonOptions(); OptionSet options = parser.parse(args); @@ -145,6 +168,10 @@ public class ScalabilityRunner { 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), diff --git oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakFixture.java oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakFixture.java index 41d1ba87e9..3ec7209a40 100644 --- oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakFixture.java +++ oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakFixture.java @@ -314,38 +314,36 @@ public abstract class OakFixture { public static OakFixture getSegmentTar(final String name, final File base, final int maxFileSizeMB, final int cacheSizeMB, final boolean memoryMapping, final boolean useBlobStore, final int dsCacheInMB, - final boolean withColdStandby, final int syncInterval, final boolean shareBlobStore) { - - SegmentTarFixtureBuilder builder = SegmentTarFixtureBuilder.segmentTarFixtureBuilder(name, base); - builder.withMaxFileSize(maxFileSizeMB) - .withSegmentCacheSize(cacheSizeMB) - .withMemoryMapping(memoryMapping) - .withBlobStore(useBlobStore) - .withDSCacheSize(dsCacheInMB); - - return new SegmentTarFixture(builder, withColdStandby, syncInterval, shareBlobStore); - } + final boolean withColdStandby, final int syncInterval, final boolean shareBlobStore, final boolean secure, + final boolean oneShotRun) { + + SegmentTarFixtureBuilder builder = SegmentTarFixtureBuilder.segmentTarFixtureBuilder(name, base); + builder.withMaxFileSize(maxFileSizeMB).withSegmentCacheSize(cacheSizeMB).withMemoryMapping(memoryMapping) + .withBlobStore(useBlobStore).withDSCacheSize(dsCacheInMB); + + return new SegmentTarFixture(builder, withColdStandby, syncInterval, shareBlobStore, secure, oneShotRun); + } public static OakFixture getVanillaSegmentTar(final File base, final int maxFileSizeMB, final int cacheSizeMB, final boolean memoryMapping) { return getSegmentTar(OakFixture.OAK_SEGMENT_TAR, base, maxFileSizeMB, cacheSizeMB, memoryMapping, false, 0, - false, -1, false); + false, -1, false, false, false); } public static OakFixture getSegmentTarWithDataStore(final File base, final int maxFileSizeMB, final int cacheSizeMB, final boolean memoryMapping, final int dsCacheInMB) { return getSegmentTar(OakFixture.OAK_SEGMENT_TAR_DS, base, maxFileSizeMB, cacheSizeMB, memoryMapping, true, dsCacheInMB, - false, -1, false); + false, -1, false, false, false); } public static OakFixture getSegmentTarWithColdStandby(final File base, final int maxFileSizeMB, final int cacheSizeMB, final boolean memoryMapping, final boolean useBlobStore, final int dsCacheInMB, - final int syncInterval, final boolean shareBlobStore) { + final int syncInterval, final boolean shareBlobStore, final boolean secure, final boolean oneShotRun) { return getSegmentTar(OakFixture.OAK_SEGMENT_TAR_COLD, base, maxFileSizeMB, cacheSizeMB, memoryMapping, useBlobStore, - dsCacheInMB, true, syncInterval, shareBlobStore); + dsCacheInMB, true, syncInterval, shareBlobStore, secure, oneShotRun); } public static OakFixture getCompositeStore(final String name, final File base, diff --git oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java index 548d1aa7f5..4222743f3b 100644 --- oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java +++ oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/OakRepositoryFixture.java @@ -107,9 +107,10 @@ public class OakRepositoryFixture implements RepositoryFixture { } public static RepositoryFixture getSegmentTarWithColdStandby(File base, int maxFileSizeMB, int cacheSizeMB, - boolean memoryMapping, boolean useBlobStore, int dsCacheInMB, int syncInterval, boolean shareBlobStore) { + boolean memoryMapping, boolean useBlobStore, int dsCacheInMB, int syncInterval, boolean shareBlobStore, + boolean secure, boolean oneShotRun) { return new OakRepositoryFixture(OakFixture.getSegmentTarWithColdStandby(base, maxFileSizeMB, cacheSizeMB, - memoryMapping, useBlobStore, dsCacheInMB, syncInterval, shareBlobStore)); + memoryMapping, useBlobStore, dsCacheInMB, syncInterval, shareBlobStore, secure, oneShotRun)); } public static RepositoryFixture getCompositeStore(File base, int maxFileSizeMB, int cacheSizeMB, diff --git oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java index 6cbd373d5e..ca4a519cc0 100644 --- oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java +++ oak-run-commons/src/main/java/org/apache/jackrabbit/oak/fixture/SegmentTarFixture.java @@ -117,6 +117,8 @@ class SegmentTarFixture extends OakFixture { private final boolean withColdStandby; private final int syncInterval; private final boolean shareBlobStore; + private final boolean oneShotRun; + private final boolean secure; private final File parentPath; @@ -128,27 +130,30 @@ class SegmentTarFixture extends OakFixture { private ScheduledExecutorService[] executors; public SegmentTarFixture(SegmentTarFixtureBuilder builder) { - this(builder, false, -1, false); + this(builder, false, -1); } public SegmentTarFixture(SegmentTarFixtureBuilder builder, boolean withColdStandby, int syncInterval) { - this(builder, withColdStandby, syncInterval, false); + this(builder, withColdStandby, syncInterval, false, false, false); } - public SegmentTarFixture(SegmentTarFixtureBuilder builder, boolean withColdStandby, int syncInterval, boolean shareBlobStore) { + public SegmentTarFixture(SegmentTarFixtureBuilder builder, boolean withColdStandby, int syncInterval, + boolean shareBlobStore, boolean oneShotRun, boolean secure) { super(builder.name); this.base = builder.base; this.parentPath = new File(base, unique); - + this.maxFileSize = builder.maxFileSize; this.segmentCacheSize = builder.segmentCacheSize; this.memoryMapping = builder.memoryMapping; this.useBlobStore = builder.useBlobStore; this.dsCacheSize = builder.dsCacheSize; - + this.withColdStandby = withColdStandby; this.syncInterval = syncInterval; this.shareBlobStore = shareBlobStore; + this.oneShotRun = oneShotRun; + this.secure = secure; } @Override @@ -250,14 +255,19 @@ class SegmentTarFixture extends OakFixture { port = socket.getLocalPort(); } - serverSyncs[i] = new StandbyServerSync(port, stores[i], 1 * MB); - clientSyncs[i] = new StandbyClientSync("127.0.0.1", port, stores[n + i], false, DEFAULT_TIMEOUT, false, new File(StandardSystemProperty.JAVA_IO_TMPDIR.value())); + serverSyncs[i] = new StandbyServerSync(port, stores[i], 1 * MB, secure); + clientSyncs[i] = new StandbyClientSync("127.0.0.1", port, stores[n + i], secure, DEFAULT_TIMEOUT, false, new File(StandardSystemProperty.JAVA_IO_TMPDIR.value())); serverSyncs[i].start(); clientSyncs[i].start(); - executors[i] = Executors.newScheduledThreadPool(1); - executors[i].scheduleAtFixedRate(clientSyncs[i], 0, syncInterval, TimeUnit.SECONDS); + if (!oneShotRun) { + serverSyncs[i].start(); + clientSyncs[i].start(); + + executors[i] = Executors.newScheduledThreadPool(1); + executors[i].scheduleAtFixedRate(clientSyncs[i], 0, syncInterval, TimeUnit.SECONDS); + } } /** @@ -285,7 +295,10 @@ class SegmentTarFixture extends OakFixture { serverSyncs = new StandbyServerSync[n]; clientSyncs = new StandbyClientSync[n]; - executors = new ScheduledExecutorService[n]; + + if (!oneShotRun) { + executors = new ScheduledExecutorService[n]; + } } else { if (useBlobStore) { blobStoresLength = n; @@ -307,8 +320,10 @@ class SegmentTarFixture extends OakFixture { serverSync.close(); } - for (ExecutorService executor : executors) { - executor.shutdownNow(); + if (!oneShotRun) { + for (ExecutorService executor : executors) { + executor.shutdownNow(); + } } }