From a7f10e87cede445da67fd52e7b74a8a968967e02 Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Wed, 27 May 2026 02:15:03 +0530 Subject: [PATCH 1/4] Remove legacy client benchmark and noop API plugin modules The client/benchmark harness and client/client-benchmark-noop-api-plugin have no references from the maintained opensearch-benchmark project and are not executed by any CI workflow. Keeping them incurs ongoing build and dependency maintenance cost with no active usage. Remove both modules and clean up references in: - settings.gradle - gradle/missing-javadoc.gradle - .github/dependabot.yml Resolves #21708 Signed-off-by: Radhakrishnan Pachyappan --- .github/dependabot.yml | 16 -- client/benchmark/README.md | 61 ------ client/benchmark/build.gradle | 60 ------ .../client/benchmark/AbstractBenchmark.java | 197 ----------------- .../client/benchmark/BenchmarkMain.java | 52 ----- .../client/benchmark/BenchmarkRunner.java | 122 ----------- .../client/benchmark/BenchmarkTask.java | 42 ---- .../client/benchmark/metrics/Metrics.java | 87 -------- .../benchmark/metrics/MetricsCalculator.java | 107 ---------- .../client/benchmark/metrics/Sample.java | 72 ------- .../benchmark/metrics/SampleRecorder.java | 57 ----- .../benchmark/ops/bulk/BulkBenchmarkTask.java | 202 ------------------ .../ops/bulk/BulkRequestExecutor.java | 38 ---- .../ops/search/SearchBenchmarkTask.java | 96 --------- .../ops/search/SearchRequestExecutor.java | 36 ---- .../benchmark/rest/RestClientBenchmark.java | 126 ----------- .../src/main/resources/log4j2.properties | 18 -- .../README.md | 23 -- .../build.gradle | 48 ----- .../opensearch/plugin/noop/NoopPlugin.java | 78 ------- .../noop/action/bulk/NoopBulkAction.java | 45 ---- .../noop/action/bulk/RestNoopBulkAction.java | 146 ------------- .../action/bulk/TransportNoopBulkAction.java | 70 ------ .../noop/action/search/NoopSearchAction.java | 44 ---- .../action/search/RestNoopSearchAction.java | 71 ------ .../search/TransportNoopSearchAction.java | 83 ------- gradle/missing-javadoc.gradle | 2 - settings.gradle | 2 - 28 files changed, 2001 deletions(-) delete mode 100644 client/benchmark/README.md delete mode 100644 client/benchmark/build.gradle delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkMain.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkTask.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Sample.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/SampleRecorder.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkRequestExecutor.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchRequestExecutor.java delete mode 100644 client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java delete mode 100644 client/benchmark/src/main/resources/log4j2.properties delete mode 100644 client/client-benchmark-noop-api-plugin/README.md delete mode 100644 client/client-benchmark-noop-api-plugin/build.gradle delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/NoopBulkAction.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/NoopSearchAction.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java delete mode 100644 client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 28c0d861158b8..327b23d2206cc 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -149,22 +149,6 @@ updates: labels: - "dependabot" - "dependencies" - - directory: /client/benchmark/ - open-pull-requests-limit: 1 - package-ecosystem: gradle - schedule: - interval: weekly - labels: - - "dependabot" - - "dependencies" - - directory: /client/client-benchmark-noop-api-plugin/ - open-pull-requests-limit: 1 - package-ecosystem: gradle - schedule: - interval: weekly - labels: - - "dependabot" - - "dependencies" - directory: /client/rest/ open-pull-requests-limit: 1 package-ecosystem: gradle diff --git a/client/benchmark/README.md b/client/benchmark/README.md deleted file mode 100644 index 2732586b9e575..0000000000000 --- a/client/benchmark/README.md +++ /dev/null @@ -1,61 +0,0 @@ -### Steps to execute the benchmark - -1. Build `client-benchmark-noop-api-plugin` with `./gradlew :client:client-benchmark-noop-api-plugin:assemble` -2. Install it on the target host with `bin/opensearch-plugin install file:///full/path/to/client-benchmark-noop-api-plugin.zip`. -3. Start OpenSearch on the target host (ideally *not* on the machine -that runs the benchmarks) -4. Run the benchmark with -``` -./gradlew -p client/benchmark run --args ' params go here' -``` - -Everything in the `'` gets sent on the command line to JMH. The leading ` ` -inside the `'`s is important. Without it parameters are sometimes sent to -gradle. - -See below for some example invocations. - -### Example benchmark - -In general, you should define a few GC-related settings `-Xms8192M -Xmx8192M -XX:+UseConcMarkSweepGC -verbose:gc -XX:+PrintGCDetails` and keep an eye on GC activity. You can also define `-XX:+PrintCompilation` to see JIT activity. - -#### Bulk indexing - -Download benchmark data and decompress them. - -Example invocation: - -``` -wget http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents-2.json.bz2 -bzip2 -d documents-2.json.bz2 -mv documents-2.json client/benchmark/build -gradlew -p client/benchmark run --args ' rest bulk localhost build/documents-2.json geonames 8647880 5000' -``` - -The parameters are all in the `'`s and are in order: - -* Client type: Use "rest" -* Benchmark type: Use either "bulk" or "search" -* Benchmark target host IP (the host where OpenSearch is running) -* full path to the file that should be bulk indexed -* name of the index -* number of documents in the file -* bulk size - - -#### Search - -Example invocation: - -``` -./gradlew -p client/benchmark run --args ' rest search localhost geonames {"query":{"match_phrase":{"name":"Sankt Georgen"}}} 500,1000,1100,1200' -``` - -The parameters are in order: - -* Client type: Use "rest" -* Benchmark type: Use either "bulk" or "search" -* Benchmark target host IP (the host where OpenSearch is running) -* name of the index -* a search request body (remember to escape double quotes). -* A comma-separated list of target throughput rates diff --git a/client/benchmark/build.gradle b/client/benchmark/build.gradle deleted file mode 100644 index c1af5fa92e35c..0000000000000 --- a/client/benchmark/build.gradle +++ /dev/null @@ -1,60 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -apply plugin: 'opensearch.build' -apply plugin: 'application' - -base { - group = 'org.opensearch.client' - archivesName = 'client-benchmarks' -} - -// Not published so no need to assemble -assemble.enabled = true - -application { - mainClass = 'org.opensearch.client.benchmark.BenchmarkMain' -} - -// never try to invoke tests on the benchmark project - there aren't any -test.enabled = false - -dependencies { - api 'org.apache.commons:commons-math3:3.6.1' - - api project(":client:rest") - // bottleneck should be the client, not OpenSearch - api project(path: ':client:client-benchmark-noop-api-plugin') - api project(":server") -} - -// No licenses for our benchmark deps (we don't ship benchmarks) -tasks.named("dependencyLicenses").configure { it.enabled = false } -dependenciesInfo.enabled = false diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java deleted file mode 100644 index ab0a0d6b8a19c..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/AbstractBenchmark.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark; - -import org.opensearch.client.benchmark.ops.bulk.BulkBenchmarkTask; -import org.opensearch.client.benchmark.ops.bulk.BulkRequestExecutor; -import org.opensearch.client.benchmark.ops.search.SearchBenchmarkTask; -import org.opensearch.client.benchmark.ops.search.SearchRequestExecutor; -import org.opensearch.common.SuppressForbidden; - -import java.io.Closeable; -import java.lang.management.GarbageCollectorMXBean; -import java.lang.management.ManagementFactory; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -public abstract class AbstractBenchmark { - private static final int SEARCH_BENCHMARK_ITERATIONS = 10_000; - - protected abstract T client(String benchmarkTargetHost) throws Exception; - - protected abstract BulkRequestExecutor bulkRequestExecutor(T client, String indexName); - - protected abstract SearchRequestExecutor searchRequestExecutor(T client, String indexName); - - @SuppressForbidden(reason = "system out is ok for a command line tool") - public final void run(String[] args) throws Exception { - if (args.length < 1) { - System.err.println("usage: [search|bulk]"); - System.exit(1); - } - switch (args[0]) { - case "search": - runSearchBenchmark(args); - break; - case "bulk": - runBulkIndexBenchmark(args); - break; - default: - System.err.println("Unknown benchmark type [" + args[0] + "]"); - System.exit(1); - - } - - } - - @SuppressForbidden(reason = "system out is ok for a command line tool") - private void runBulkIndexBenchmark(String[] args) throws Exception { - if (args.length != 6) { - System.err.println("usage: 'bulk' benchmarkTargetHostIp indexFilePath indexName numberOfDocuments bulkSize"); - System.exit(1); - } - String benchmarkTargetHost = args[1]; - String indexFilePath = args[2]; - String indexName = args[3]; - int totalDocs = Integer.valueOf(args[4]); - int bulkSize = Integer.valueOf(args[5]); - - int totalIterationCount = (int) Math.floor(totalDocs / bulkSize); - // consider 40% of all iterations as warmup iterations - int warmupIterations = (int) (0.4d * totalIterationCount); - int iterations = totalIterationCount - warmupIterations; - - T client = client(benchmarkTargetHost); - - BenchmarkRunner benchmark = new BenchmarkRunner( - warmupIterations, - iterations, - new BulkBenchmarkTask(bulkRequestExecutor(client, indexName), indexFilePath, warmupIterations, iterations, bulkSize) - ); - - try { - runTrials(() -> { - runGc(); - benchmark.run(); - }); - } finally { - client.close(); - } - - } - - @SuppressForbidden(reason = "system out is ok for a command line tool") - private void runSearchBenchmark(String[] args) throws Exception { - if (args.length != 5) { - System.err.println("usage: 'search' benchmarkTargetHostIp indexName searchRequestBody throughputRates"); - System.exit(1); - } - String benchmarkTargetHost = args[1]; - String indexName = args[2]; - String searchBody = args[3]; - List throughputRates = Arrays.asList(args[4].split(",")).stream().map(Integer::valueOf).collect(Collectors.toList()); - - T client = client(benchmarkTargetHost); - - try { - runTrials(() -> { - for (int throughput : throughputRates) { - // GC between trials to reduce the likelihood of a GC occurring in the middle of a trial. - runGc(); - BenchmarkRunner benchmark = new BenchmarkRunner( - SEARCH_BENCHMARK_ITERATIONS, - SEARCH_BENCHMARK_ITERATIONS, - new SearchBenchmarkTask( - searchRequestExecutor(client, indexName), - searchBody, - SEARCH_BENCHMARK_ITERATIONS, - SEARCH_BENCHMARK_ITERATIONS, - throughput - ) - ); - System.out.printf("Target throughput = %d ops / s%n", throughput); - benchmark.run(); - } - }); - } finally { - client.close(); - } - } - - @SuppressForbidden(reason = "system out is ok for a command line tool") - private void runTrials(Runnable runner) { - int totalWarmupTrialRuns = 1; - for (int run = 1; run <= totalWarmupTrialRuns; run++) { - System.out.println("======================"); - System.out.println(" Warmup trial run " + run + "/" + totalWarmupTrialRuns); - System.out.println("======================"); - runner.run(); - } - - int totalTrialRuns = 5; - for (int run = 1; run <= totalTrialRuns; run++) { - System.out.println("================"); - System.out.println(" Trial run " + run + "/" + totalTrialRuns); - System.out.println("================"); - - runner.run(); - } - } - - /** - * Requests a full GC and checks whether the GC did actually run after a request. It retries up to 5 times in case the GC did not - * run in time. - */ - @SuppressForbidden(reason = "we need to request a system GC for the benchmark") - private void runGc() { - long previousCollections = getTotalGcCount(); - int attempts = 0; - do { - // request a full GC ... - System.gc(); - // ... and give GC a chance to run - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return; - } - attempts++; - } while (previousCollections == getTotalGcCount() || attempts < 5); - } - - private long getTotalGcCount() { - List gcMxBeans = ManagementFactory.getGarbageCollectorMXBeans(); - return gcMxBeans.stream().mapToLong(GarbageCollectorMXBean::getCollectionCount).sum(); - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkMain.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkMain.java deleted file mode 100644 index 8b8dfc1e1de7d..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkMain.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark; - -import org.opensearch.client.benchmark.rest.RestClientBenchmark; -import org.opensearch.common.SuppressForbidden; - -import java.util.Arrays; - -public class BenchmarkMain { - @SuppressForbidden(reason = "system out is ok for a command line tool") - public static void main(String[] args) throws Exception { - String type = args[0]; - AbstractBenchmark benchmark = null; - if ("rest".equals(type)) { - benchmark = new RestClientBenchmark(); - } else { - System.err.println("Unknown client type [" + type + "]"); - System.exit(1); - } - benchmark.run(Arrays.copyOfRange(args, 1, args.length)); - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java deleted file mode 100644 index 4beb82b939bc9..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkRunner.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark; - -import org.opensearch.client.benchmark.metrics.Metrics; -import org.opensearch.client.benchmark.metrics.MetricsCalculator; -import org.opensearch.client.benchmark.metrics.Sample; -import org.opensearch.client.benchmark.metrics.SampleRecorder; -import org.opensearch.common.SuppressForbidden; - -import java.util.Arrays; -import java.util.List; -import java.util.Locale; - -public final class BenchmarkRunner { - private final int warmupIterations; - private final int iterations; - private final BenchmarkTask task; - - public BenchmarkRunner(int warmupIterations, int iterations, BenchmarkTask task) { - this.warmupIterations = warmupIterations; - this.iterations = iterations; - this.task = task; - } - - @SuppressForbidden(reason = "system out is ok for a command line tool") - public void run() { - SampleRecorder recorder = new SampleRecorder(iterations); - System.out.printf( - "Running %s with %d warmup iterations and %d iterations.%n", - task.getClass().getSimpleName(), - warmupIterations, - iterations - ); - - try { - task.setUp(recorder); - task.run(); - task.tearDown(); - } catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - return; - } catch (Exception ex) { - throw new RuntimeException(ex); - } - - List samples = recorder.getSamples(); - final List summaryMetrics = MetricsCalculator.calculate(samples); - - if (summaryMetrics.isEmpty()) { - System.out.println("No results."); - } - - for (Metrics metrics : summaryMetrics) { - String throughput = String.format(Locale.ROOT, "Throughput [ops/s]: %f", metrics.throughput); - String serviceTimes = String.format( - Locale.ROOT, - "Service time [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f", - metrics.serviceTimeP50, - metrics.serviceTimeP90, - metrics.serviceTimeP95, - metrics.serviceTimeP99, - metrics.serviceTimeP999, - metrics.serviceTimeP9999 - ); - String latencies = String.format( - Locale.ROOT, - "Latency [ms]: p50 = %f, p90 = %f, p95 = %f, p99 = %f, p99.9 = %f, p99.99 = %f", - metrics.latencyP50, - metrics.latencyP90, - metrics.latencyP95, - metrics.latencyP99, - metrics.latencyP999, - metrics.latencyP9999 - ); - - int lineLength = Math.max(serviceTimes.length(), latencies.length()); - - System.out.println(repeat(lineLength, '-')); - System.out.println(throughput); - System.out.println(serviceTimes); - System.out.println(latencies); - System.out.printf("success count = %d, error count = %d%n", metrics.successCount, metrics.errorCount); - System.out.println(repeat(lineLength, '-')); - } - } - - private String repeat(int times, char character) { - char[] characters = new char[times]; - Arrays.fill(characters, character); - return new String(characters); - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkTask.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkTask.java deleted file mode 100644 index 4e6b8b4c52287..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/BenchmarkTask.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark; - -import org.opensearch.client.benchmark.metrics.SampleRecorder; - -public interface BenchmarkTask { - void setUp(SampleRecorder sampleRecorder) throws Exception; - - void run() throws Exception; - - void tearDown() throws Exception; -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java deleted file mode 100644 index 93bf01d12641b..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Metrics.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.metrics; - -public final class Metrics { - public final String operation; - public final long successCount; - public final long errorCount; - public final double throughput; - public final double serviceTimeP50; - public final double serviceTimeP90; - public final double serviceTimeP95; - public final double serviceTimeP99; - public final double serviceTimeP999; - public final double serviceTimeP9999; - public final double latencyP50; - public final double latencyP90; - public final double latencyP95; - public final double latencyP99; - public final double latencyP999; - public final double latencyP9999; - - public Metrics( - String operation, - long successCount, - long errorCount, - double throughput, - double serviceTimeP50, - double serviceTimeP90, - double serviceTimeP95, - double serviceTimeP99, - double serviceTimeP999, - double serviceTimeP9999, - double latencyP50, - double latencyP90, - double latencyP95, - double latencyP99, - double latencyP999, - double latencyP9999 - ) { - this.operation = operation; - this.successCount = successCount; - this.errorCount = errorCount; - this.throughput = throughput; - this.serviceTimeP50 = serviceTimeP50; - this.serviceTimeP90 = serviceTimeP90; - this.serviceTimeP95 = serviceTimeP95; - this.serviceTimeP99 = serviceTimeP99; - this.serviceTimeP999 = serviceTimeP999; - this.serviceTimeP9999 = serviceTimeP9999; - this.latencyP50 = latencyP50; - this.latencyP90 = latencyP90; - this.latencyP95 = latencyP95; - this.latencyP99 = latencyP99; - this.latencyP999 = latencyP999; - this.latencyP9999 = latencyP9999; - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java deleted file mode 100644 index b64ea8143d7ae..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/MetricsCalculator.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.metrics; - -import org.apache.commons.math3.stat.StatUtils; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -public final class MetricsCalculator { - public static List calculate(Collection samples) { - Map> samplesPerOperation = groupByOperation(samples); - return calculateMetricsPerOperation(samplesPerOperation); - } - - private static Map> groupByOperation(Collection samples) { - Map> samplesPerOperation = new HashMap<>(); - - for (Sample sample : samples) { - if (!samplesPerOperation.containsKey(sample.getOperation())) { - samplesPerOperation.put(sample.getOperation(), new ArrayList<>()); - } - samplesPerOperation.get(sample.getOperation()).add(sample); - } - return samplesPerOperation; - } - - private static List calculateMetricsPerOperation(Map> samplesPerOperation) { - List metrics = new ArrayList<>(); - for (Map.Entry> operationAndMetrics : samplesPerOperation.entrySet()) { - List samples = operationAndMetrics.getValue(); - double[] serviceTimes = new double[samples.size()]; - double[] latencies = new double[samples.size()]; - int it = 0; - long firstStart = Long.MAX_VALUE; - long latestEnd = Long.MIN_VALUE; - for (Sample sample : samples) { - firstStart = Math.min(sample.getStartTimestamp(), firstStart); - latestEnd = Math.max(sample.getStopTimestamp(), latestEnd); - serviceTimes[it] = sample.getServiceTime(); - latencies[it] = sample.getLatency(); - it++; - } - - metrics.add( - new Metrics( - operationAndMetrics.getKey(), - samples.stream().filter((r) -> r.isSuccess()).count(), - samples.stream().filter((r) -> !r.isSuccess()).count(), - // throughput calculation is based on the total (Wall clock) time it took to generate all samples - calculateThroughput(samples.size(), latestEnd - firstStart), - // convert ns -> ms without losing precision - StatUtils.percentile(serviceTimes, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(serviceTimes, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(serviceTimes, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(serviceTimes, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(serviceTimes, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(serviceTimes, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 50.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 90.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 95.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 99.0d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 99.9d) / TimeUnit.MILLISECONDS.toNanos(1L), - StatUtils.percentile(latencies, 99.99d) / TimeUnit.MILLISECONDS.toNanos(1L) - ) - ); - } - return metrics; - } - - private static double calculateThroughput(int sampleSize, double duration) { - return sampleSize * (TimeUnit.SECONDS.toNanos(1L) / duration); - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Sample.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Sample.java deleted file mode 100644 index 0ac9d0a6e040b..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/Sample.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.metrics; - -public final class Sample { - private final String operation; - private final long expectedStartTimestamp; - private final long startTimestamp; - private final long stopTimestamp; - private final boolean success; - - public Sample(String operation, long expectedStartTimestamp, long startTimestamp, long stopTimestamp, boolean success) { - this.operation = operation; - this.expectedStartTimestamp = expectedStartTimestamp; - this.startTimestamp = startTimestamp; - this.stopTimestamp = stopTimestamp; - this.success = success; - } - - public String getOperation() { - return operation; - } - - public boolean isSuccess() { - return success; - } - - public long getStartTimestamp() { - return startTimestamp; - } - - public long getStopTimestamp() { - return stopTimestamp; - } - - public long getServiceTime() { - return stopTimestamp - startTimestamp; - } - - public long getLatency() { - return stopTimestamp - expectedStartTimestamp; - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/SampleRecorder.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/SampleRecorder.java deleted file mode 100644 index 9cd12f5e78bd0..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/metrics/SampleRecorder.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.metrics; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * Stores measurement samples. - *

- * This class is NOT threadsafe. - */ -public final class SampleRecorder { - private final List samples; - - public SampleRecorder(int iterations) { - this.samples = new ArrayList<>(iterations); - } - - public void addSample(Sample sample) { - samples.add(sample); - } - - public List getSamples() { - return Collections.unmodifiableList(samples); - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java deleted file mode 100644 index 5d2b9cb764a6f..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkBenchmarkTask.java +++ /dev/null @@ -1,202 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.ops.bulk; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.opensearch.OpenSearchException; -import org.opensearch.client.benchmark.BenchmarkTask; -import org.opensearch.client.benchmark.metrics.Sample; -import org.opensearch.client.benchmark.metrics.SampleRecorder; -import org.opensearch.common.SuppressForbidden; -import org.opensearch.common.io.PathUtils; - -import java.io.BufferedReader; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ArrayBlockingQueue; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; - -public class BulkBenchmarkTask implements BenchmarkTask { - private final BulkRequestExecutor requestExecutor; - private final String indexFilePath; - private final int warmupIterations; - private final int measurementIterations; - private final int bulkSize; - private LoadGenerator generator; - private ExecutorService executorService; - - public BulkBenchmarkTask( - BulkRequestExecutor requestExecutor, - String indexFilePath, - int warmupIterations, - int measurementIterations, - int bulkSize - ) { - this.requestExecutor = requestExecutor; - this.indexFilePath = indexFilePath; - this.warmupIterations = warmupIterations; - this.measurementIterations = measurementIterations; - this.bulkSize = bulkSize; - } - - @Override - @SuppressForbidden(reason = "PathUtils#get is fine - we don't have environment here") - public void setUp(SampleRecorder sampleRecorder) { - BlockingQueue> bulkQueue = new ArrayBlockingQueue<>(256); - - BulkIndexer runner = new BulkIndexer(bulkQueue, warmupIterations, measurementIterations, sampleRecorder, requestExecutor); - - executorService = Executors.newSingleThreadExecutor((r) -> new Thread(r, "bulk-index-runner")); - executorService.submit(runner); - - generator = new LoadGenerator(PathUtils.get(indexFilePath), bulkQueue, bulkSize); - } - - @Override - @SuppressForbidden(reason = "system out is ok for a command line tool") - public void run() throws Exception { - generator.execute(); - // when the generator is done, there are no more data -> shutdown client - executorService.shutdown(); - // We need to wait until the queue is drained - final boolean finishedNormally = executorService.awaitTermination(20, TimeUnit.MINUTES); - if (finishedNormally == false) { - System.err.println("Background tasks are still running after timeout on enclosing pool. Forcing pool shutdown."); - executorService.shutdownNow(); - } - } - - @Override - public void tearDown() { - // no op - } - - private static final class LoadGenerator { - private final Path bulkDataFile; - private final BlockingQueue> bulkQueue; - private final int bulkSize; - - LoadGenerator(Path bulkDataFile, BlockingQueue> bulkQueue, int bulkSize) { - this.bulkDataFile = bulkDataFile; - this.bulkQueue = bulkQueue; - this.bulkSize = bulkSize; - } - - @SuppressForbidden(reason = "Classic I/O is fine in non-production code") - public void execute() { - try (BufferedReader reader = Files.newBufferedReader(bulkDataFile, StandardCharsets.UTF_8)) { - String line; - int bulkIndex = 0; - List bulkData = new ArrayList<>(bulkSize); - while ((line = reader.readLine()) != null) { - if (bulkIndex == bulkSize) { - sendBulk(bulkData); - // reset data structures - bulkData = new ArrayList<>(bulkSize); - bulkIndex = 0; - } - bulkData.add(line); - bulkIndex++; - } - // also send the last bulk: - if (bulkIndex > 0) { - sendBulk(bulkData); - } - } catch (IOException e) { - throw new OpenSearchException(e); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - } - - private void sendBulk(List bulkData) throws InterruptedException { - bulkQueue.put(bulkData); - } - } - - private static final class BulkIndexer implements Runnable { - private static final Logger logger = LogManager.getLogger(BulkIndexer.class); - - private final BlockingQueue> bulkData; - private final int warmupIterations; - private final int measurementIterations; - private final BulkRequestExecutor bulkRequestExecutor; - private final SampleRecorder sampleRecorder; - - BulkIndexer( - BlockingQueue> bulkData, - int warmupIterations, - int measurementIterations, - SampleRecorder sampleRecorder, - BulkRequestExecutor bulkRequestExecutor - ) { - this.bulkData = bulkData; - this.warmupIterations = warmupIterations; - this.measurementIterations = measurementIterations; - this.bulkRequestExecutor = bulkRequestExecutor; - this.sampleRecorder = sampleRecorder; - } - - @Override - public void run() { - for (int iteration = 0; iteration < warmupIterations + measurementIterations; iteration++) { - boolean success = false; - List currentBulk; - try { - currentBulk = bulkData.take(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - return; - } - // measure only service time, latency is not that interesting for a throughput benchmark - long start = System.nanoTime(); - try { - success = bulkRequestExecutor.bulkIndex(currentBulk); - } catch (Exception ex) { - logger.warn("Error while executing bulk request", ex); - } - long stop = System.nanoTime(); - if (iteration < warmupIterations) { - sampleRecorder.addSample(new Sample("bulk", start, start, stop, success)); - } - } - } - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkRequestExecutor.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkRequestExecutor.java deleted file mode 100644 index f7545556ae3a8..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/bulk/BulkRequestExecutor.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.ops.bulk; - -import java.util.List; - -public interface BulkRequestExecutor { - boolean bulkIndex(List bulkData); -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java deleted file mode 100644 index 3b232cb3bdbc3..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchBenchmarkTask.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.ops.search; - -import org.opensearch.client.benchmark.BenchmarkTask; -import org.opensearch.client.benchmark.metrics.Sample; -import org.opensearch.client.benchmark.metrics.SampleRecorder; - -import java.util.concurrent.TimeUnit; - -public class SearchBenchmarkTask implements BenchmarkTask { - private final SearchRequestExecutor searchRequestExecutor; - private final String searchRequestBody; - private final int warmupIterations; - private final int measurementIterations; - private final int targetThroughput; - - private SampleRecorder sampleRecorder; - - public SearchBenchmarkTask( - SearchRequestExecutor searchRequestExecutor, - String body, - int warmupIterations, - int measurementIterations, - int targetThroughput - ) { - this.searchRequestExecutor = searchRequestExecutor; - this.searchRequestBody = body; - this.warmupIterations = warmupIterations; - this.measurementIterations = measurementIterations; - this.targetThroughput = targetThroughput; - } - - @Override - public void setUp(SampleRecorder sampleRecorder) throws Exception { - this.sampleRecorder = sampleRecorder; - } - - @Override - public void run() throws Exception { - runIterations(warmupIterations, false); - runIterations(measurementIterations, true); - } - - private void runIterations(int iterations, boolean addSample) { - long interval = TimeUnit.SECONDS.toNanos(1L) / targetThroughput; - - long totalStart = System.nanoTime(); - for (int iteration = 0; iteration < iterations; iteration++) { - long expectedStart = totalStart + iteration * interval; - while (System.nanoTime() < expectedStart) { - // busy spin - } - long start = System.nanoTime(); - boolean success = searchRequestExecutor.search(searchRequestBody); - long stop = System.nanoTime(); - if (addSample) { - sampleRecorder.addSample(new Sample("search", expectedStart, start, stop, success)); - } - } - } - - @Override - public void tearDown() throws Exception { - // no op - } -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchRequestExecutor.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchRequestExecutor.java deleted file mode 100644 index 85c7075b79468..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/ops/search/SearchRequestExecutor.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.ops.search; - -public interface SearchRequestExecutor { - boolean search(String source); -} diff --git a/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java b/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java deleted file mode 100644 index e8dcff814603d..0000000000000 --- a/client/benchmark/src/main/java/org/opensearch/client/benchmark/rest/RestClientBenchmark.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.benchmark.rest; - -import org.apache.hc.core5.http.HttpHeaders; -import org.apache.hc.core5.http.HttpHost; -import org.apache.hc.core5.http.HttpStatus; -import org.apache.hc.core5.http.message.BasicHeader; -import org.opensearch.OpenSearchException; -import org.opensearch.client.Request; -import org.opensearch.client.Response; -import org.opensearch.client.RestClient; -import org.opensearch.client.benchmark.AbstractBenchmark; -import org.opensearch.client.benchmark.ops.bulk.BulkRequestExecutor; -import org.opensearch.client.benchmark.ops.search.SearchRequestExecutor; - -import java.io.IOException; -import java.util.Collections; -import java.util.List; -import java.util.Locale; - -public final class RestClientBenchmark extends AbstractBenchmark { - public static void main(String[] args) throws Exception { - RestClientBenchmark b = new RestClientBenchmark(); - b.run(args); - } - - @Override - protected RestClient client(String benchmarkTargetHost) { - return RestClient.builder(new HttpHost(benchmarkTargetHost, 9200)) - .setHttpClientConfigCallback( - b -> b.setDefaultHeaders(Collections.singleton(new BasicHeader(HttpHeaders.ACCEPT_ENCODING, "gzip"))) - ) - .setRequestConfigCallback(b -> b.setContentCompressionEnabled(true)) - .build(); - } - - @Override - protected BulkRequestExecutor bulkRequestExecutor(RestClient client, String indexName) { - return new RestBulkRequestExecutor(client, indexName); - } - - @Override - protected SearchRequestExecutor searchRequestExecutor(RestClient client, String indexName) { - return new RestSearchRequestExecutor(client, indexName); - } - - private static final class RestBulkRequestExecutor implements BulkRequestExecutor { - private final RestClient client; - private final String actionMetadata; - - RestBulkRequestExecutor(RestClient client, String index) { - this.client = client; - this.actionMetadata = String.format(Locale.ROOT, "{ \"index\" : { \"_index\" : \"%s\" } }%n", index); - } - - @Override - public boolean bulkIndex(List bulkData) { - StringBuilder bulkRequestBody = new StringBuilder(); - for (String bulkItem : bulkData) { - bulkRequestBody.append(actionMetadata); - bulkRequestBody.append(bulkItem); - bulkRequestBody.append("\n"); - } - Request request = new Request("POST", "/geonames/_noop_bulk"); - request.setJsonEntity(bulkRequestBody.toString()); - try { - Response response = client.performRequest(request); - return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; - } catch (Exception e) { - throw new OpenSearchException(e); - } - } - } - - private static final class RestSearchRequestExecutor implements SearchRequestExecutor { - private final RestClient client; - private final String endpoint; - - private RestSearchRequestExecutor(RestClient client, String indexName) { - this.client = client; - this.endpoint = "/" + indexName + "/_noop_search"; - } - - @Override - public boolean search(String source) { - Request request = new Request("GET", endpoint); - request.setJsonEntity(source); - try { - Response response = client.performRequest(request); - return response.getStatusLine().getStatusCode() == HttpStatus.SC_OK; - } catch (IOException e) { - throw new OpenSearchException(e); - } - } - } -} diff --git a/client/benchmark/src/main/resources/log4j2.properties b/client/benchmark/src/main/resources/log4j2.properties deleted file mode 100644 index bdcf50a2d988c..0000000000000 --- a/client/benchmark/src/main/resources/log4j2.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# SPDX-License-Identifier: Apache-2.0 -# -# The OpenSearch Contributors require contributions made to -# this file be licensed under the Apache-2.0 license or a -# compatible open source license. -# -# Modifications Copyright OpenSearch Contributors. See -# GitHub history for details. -# - -appender.console.type = Console -appender.console.name = console -appender.console.layout.type = PatternLayout -appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] [%node_name]%marker %m%n - -rootLogger.level = info -rootLogger.appenderRef.console.ref = console diff --git a/client/client-benchmark-noop-api-plugin/README.md b/client/client-benchmark-noop-api-plugin/README.md deleted file mode 100644 index ef7b6303372fb..0000000000000 --- a/client/client-benchmark-noop-api-plugin/README.md +++ /dev/null @@ -1,23 +0,0 @@ -### Purpose - -This plugin provides empty REST and transport endpoints for bulk indexing and search. It is used to avoid accidental server-side bottlenecks in client-side benchmarking. - -### Build Instructions - -Build the plugin with `gradle :client:client-benchmark-noop-api-plugin:assemble` from the OpenSearch root project directory. - -### Installation Instructions - -After, the binary has been built, install it with `bin/opensearch-plugin install file:///full/path/to/noop-plugin.zip`. - -### Usage - -The plugin provides two REST endpoints: - -* `/_noop_bulk` and all variations that the bulk endpoint provides (except that all no op endpoints are called `_noop_bulk` instead of `_bulk`) -* `_noop_search` and all variations that the search endpoint provides (except that all no op endpoints are called `_noop_search` instead of `_search`) - -The corresponding transport actions are: - -* `org.opensearch.plugin.noop.action.bulk.TransportNoopBulkAction` -* `org.opensearch.plugin.noop.action.search.TransportNoopSearchAction` diff --git a/client/client-benchmark-noop-api-plugin/build.gradle b/client/client-benchmark-noop-api-plugin/build.gradle deleted file mode 100644 index feec78547edb6..0000000000000 --- a/client/client-benchmark-noop-api-plugin/build.gradle +++ /dev/null @@ -1,48 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - * - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -group = 'org.opensearch.plugin' - -apply plugin: 'opensearch.opensearchplugin' - -opensearchplugin { - name = 'client-benchmark-noop-api' - description = 'Stubbed out OpenSearch actions that can be used for client-side benchmarking' - classname = 'org.opensearch.plugin.noop.NoopPlugin' -} - -// Not published so no need to assemble -assemble.enabled = false - -tasks.named("dependencyLicenses").configure { it.enabled = false } -dependenciesInfo.enabled = false - -// no unit tests -test.enabled = false diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java deleted file mode 100644 index 56bf91d1b2360..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/NoopPlugin.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop; - -import org.opensearch.action.ActionRequest; -import org.opensearch.cluster.metadata.IndexNameExpressionResolver; -import org.opensearch.cluster.node.DiscoveryNodes; -import org.opensearch.common.settings.ClusterSettings; -import org.opensearch.common.settings.IndexScopedSettings; -import org.opensearch.common.settings.Settings; -import org.opensearch.common.settings.SettingsFilter; -import org.opensearch.core.action.ActionResponse; -import org.opensearch.plugin.noop.action.bulk.NoopBulkAction; -import org.opensearch.plugin.noop.action.bulk.RestNoopBulkAction; -import org.opensearch.plugin.noop.action.bulk.TransportNoopBulkAction; -import org.opensearch.plugin.noop.action.search.NoopSearchAction; -import org.opensearch.plugin.noop.action.search.RestNoopSearchAction; -import org.opensearch.plugin.noop.action.search.TransportNoopSearchAction; -import org.opensearch.plugins.ActionPlugin; -import org.opensearch.plugins.Plugin; -import org.opensearch.rest.RestController; -import org.opensearch.rest.RestHandler; - -import java.util.Arrays; -import java.util.List; -import java.util.function.Supplier; - -public class NoopPlugin extends Plugin implements ActionPlugin { - @Override - public List> getActions() { - return Arrays.asList( - new ActionHandler<>(NoopBulkAction.INSTANCE, TransportNoopBulkAction.class), - new ActionHandler<>(NoopSearchAction.INSTANCE, TransportNoopSearchAction.class) - ); - } - - @Override - public List getRestHandlers( - Settings settings, - RestController restController, - ClusterSettings clusterSettings, - IndexScopedSettings indexScopedSettings, - SettingsFilter settingsFilter, - IndexNameExpressionResolver indexNameExpressionResolver, - Supplier nodesInCluster - ) { - return Arrays.asList(new RestNoopBulkAction(), new RestNoopSearchAction()); - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/NoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/NoopBulkAction.java deleted file mode 100644 index 8e6f7fb9e74c9..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/NoopBulkAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.bulk; - -import org.opensearch.action.ActionType; -import org.opensearch.action.bulk.BulkResponse; - -public class NoopBulkAction extends ActionType { - public static final String NAME = "mock:data/write/bulk"; - - public static final NoopBulkAction INSTANCE = new NoopBulkAction(); - - private NoopBulkAction() { - super(NAME, BulkResponse::new); - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java deleted file mode 100644 index 069c1efa029b9..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/RestNoopBulkAction.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.bulk; - -import org.opensearch.action.DocWriteRequest; -import org.opensearch.action.DocWriteResponse; -import org.opensearch.action.bulk.BulkItemResponse; -import org.opensearch.action.bulk.BulkRequest; -import org.opensearch.action.bulk.BulkShardRequest; -import org.opensearch.action.support.ActiveShardCount; -import org.opensearch.action.update.UpdateResponse; -import org.opensearch.core.index.shard.ShardId; -import org.opensearch.core.xcontent.XContentBuilder; -import org.opensearch.rest.BaseRestHandler; -import org.opensearch.rest.BytesRestResponse; -import org.opensearch.rest.RestChannel; -import org.opensearch.rest.RestRequest; -import org.opensearch.rest.RestResponse; -import org.opensearch.rest.action.RestBuilderListener; -import org.opensearch.transport.client.Requests; -import org.opensearch.transport.client.node.NodeClient; - -import java.io.IOException; -import java.util.List; - -import static java.util.Arrays.asList; -import static java.util.Collections.unmodifiableList; -import static org.opensearch.core.rest.RestStatus.OK; -import static org.opensearch.rest.RestRequest.Method.POST; -import static org.opensearch.rest.RestRequest.Method.PUT; - -public class RestNoopBulkAction extends BaseRestHandler { - - @Override - public List routes() { - return unmodifiableList( - asList( - new Route(POST, "/_noop_bulk"), - new Route(PUT, "/_noop_bulk"), - new Route(POST, "/{index}/_noop_bulk"), - new Route(PUT, "/{index}/_noop_bulk") - ) - ); - } - - @Override - public String getName() { - return "noop_bulk_action"; - } - - @Override - public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { - BulkRequest bulkRequest = Requests.bulkRequest(); - String defaultIndex = request.param("index"); - String defaultRouting = request.param("routing"); - String defaultPipeline = request.param("pipeline"); - Boolean defaultRequireAlias = request.paramAsBoolean("require_alias", null); - - String waitForActiveShards = request.param("wait_for_active_shards"); - if (waitForActiveShards != null) { - bulkRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards)); - } - bulkRequest.timeout(request.paramAsTime("timeout", BulkShardRequest.DEFAULT_TIMEOUT)); - bulkRequest.setRefreshPolicy(request.param("refresh")); - bulkRequest.add( - request.requiredContent(), - defaultIndex, - defaultRouting, - null, - defaultPipeline, - defaultRequireAlias, - true, - request.getMediaType() - ); - - // short circuit the call to the transport layer - return channel -> { - BulkRestBuilderListener listener = new BulkRestBuilderListener(channel, request); - listener.onResponse(bulkRequest); - }; - } - - private static class BulkRestBuilderListener extends RestBuilderListener { - private final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse( - 1, - DocWriteRequest.OpType.UPDATE, - new UpdateResponse(new ShardId("mock", "", 1), "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED) - ); - - private final RestRequest request; - - BulkRestBuilderListener(RestChannel channel, RestRequest request) { - super(channel); - this.request = request; - } - - @Override - public RestResponse buildResponse(BulkRequest bulkRequest, XContentBuilder builder) throws Exception { - builder.startObject(); - builder.field(Fields.TOOK, 0); - builder.field(Fields.ERRORS, false); - builder.startArray(Fields.ITEMS); - for (int idx = 0; idx < bulkRequest.numberOfActions(); idx++) { - ITEM_RESPONSE.toXContent(builder, request); - } - builder.endArray(); - builder.endObject(); - return new BytesRestResponse(OK, builder); - } - } - - static final class Fields { - static final String ITEMS = "items"; - static final String ERRORS = "errors"; - static final String TOOK = "took"; - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java deleted file mode 100644 index 77d4d3d095b29..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/bulk/TransportNoopBulkAction.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.bulk; - -import org.opensearch.action.DocWriteRequest; -import org.opensearch.action.DocWriteResponse; -import org.opensearch.action.bulk.BulkItemResponse; -import org.opensearch.action.bulk.BulkRequest; -import org.opensearch.action.bulk.BulkResponse; -import org.opensearch.action.support.ActionFilters; -import org.opensearch.action.support.HandledTransportAction; -import org.opensearch.action.update.UpdateResponse; -import org.opensearch.common.inject.Inject; -import org.opensearch.core.action.ActionListener; -import org.opensearch.core.index.shard.ShardId; -import org.opensearch.tasks.Task; -import org.opensearch.transport.TransportService; - -public class TransportNoopBulkAction extends HandledTransportAction { - private static final BulkItemResponse ITEM_RESPONSE = new BulkItemResponse( - 1, - DocWriteRequest.OpType.UPDATE, - new UpdateResponse(new ShardId("mock", "", 1), "1", 0L, 1L, 1L, DocWriteResponse.Result.CREATED) - ); - - @Inject - public TransportNoopBulkAction(TransportService transportService, ActionFilters actionFilters) { - super(NoopBulkAction.NAME, transportService, actionFilters, BulkRequest::new); - } - - @Override - protected void doExecute(Task task, BulkRequest request, ActionListener listener) { - final int itemCount = request.requests().size(); - // simulate at least a realistic amount of data that gets serialized - BulkItemResponse[] bulkItemResponses = new BulkItemResponse[itemCount]; - for (int idx = 0; idx < itemCount; idx++) { - bulkItemResponses[idx] = ITEM_RESPONSE; - } - listener.onResponse(new BulkResponse(bulkItemResponses, 0)); - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/NoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/NoopSearchAction.java deleted file mode 100644 index 304ba309d6053..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/NoopSearchAction.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.search; - -import org.opensearch.action.ActionType; -import org.opensearch.action.search.SearchResponse; - -public class NoopSearchAction extends ActionType { - public static final NoopSearchAction INSTANCE = new NoopSearchAction(); - public static final String NAME = "mock:data/read/search"; - - private NoopSearchAction() { - super(NAME, SearchResponse::new); - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java deleted file mode 100644 index f23cdc1eab3b3..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/RestNoopSearchAction.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.search; - -import org.opensearch.action.search.SearchRequest; -import org.opensearch.rest.BaseRestHandler; -import org.opensearch.rest.RestRequest; -import org.opensearch.rest.action.RestStatusToXContentListener; -import org.opensearch.transport.client.node.NodeClient; - -import java.util.List; - -import static java.util.Arrays.asList; -import static java.util.Collections.unmodifiableList; -import static org.opensearch.rest.RestRequest.Method.GET; -import static org.opensearch.rest.RestRequest.Method.POST; - -public class RestNoopSearchAction extends BaseRestHandler { - - @Override - public List routes() { - return unmodifiableList( - asList( - new Route(GET, "/_noop_search"), - new Route(POST, "/_noop_search"), - new Route(GET, "/{index}/_noop_search"), - new Route(POST, "/{index}/_noop_search") - ) - ); - } - - @Override - public String getName() { - return "noop_search_action"; - } - - @Override - public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) { - SearchRequest searchRequest = new SearchRequest(); - return channel -> client.execute(NoopSearchAction.INSTANCE, searchRequest, new RestStatusToXContentListener<>(channel)); - } -} diff --git a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java b/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java deleted file mode 100644 index 99efd31dfcaa5..0000000000000 --- a/client/client-benchmark-noop-api-plugin/src/main/java/org/opensearch/plugin/noop/action/search/TransportNoopSearchAction.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.plugin.noop.action.search; - -import org.apache.lucene.search.TotalHits; -import org.opensearch.action.search.SearchRequest; -import org.opensearch.action.search.SearchResponse; -import org.opensearch.action.search.ShardSearchFailure; -import org.opensearch.action.support.ActionFilters; -import org.opensearch.action.support.HandledTransportAction; -import org.opensearch.common.inject.Inject; -import org.opensearch.core.action.ActionListener; -import org.opensearch.core.common.io.stream.Writeable; -import org.opensearch.search.SearchHit; -import org.opensearch.search.SearchHits; -import org.opensearch.search.aggregations.InternalAggregations; -import org.opensearch.search.internal.InternalSearchResponse; -import org.opensearch.search.profile.SearchProfileShardResults; -import org.opensearch.search.suggest.Suggest; -import org.opensearch.tasks.Task; -import org.opensearch.transport.TransportService; - -import java.util.Collections; - -public class TransportNoopSearchAction extends HandledTransportAction { - @Inject - public TransportNoopSearchAction(TransportService transportService, ActionFilters actionFilters) { - super(NoopSearchAction.NAME, transportService, actionFilters, (Writeable.Reader) SearchRequest::new); - } - - @Override - protected void doExecute(Task task, SearchRequest request, ActionListener listener) { - listener.onResponse( - new SearchResponse( - new InternalSearchResponse( - new SearchHits(new SearchHit[0], new TotalHits(0L, TotalHits.Relation.EQUAL_TO), 0.0f), - InternalAggregations.EMPTY, - new Suggest(Collections.emptyList()), - new SearchProfileShardResults(Collections.emptyMap()), - false, - false, - 1 - ), - "", - 1, - 1, - 0, - 0, - ShardSearchFailure.EMPTY_ARRAY, - SearchResponse.Clusters.EMPTY - ) - ); - } -} diff --git a/gradle/missing-javadoc.gradle b/gradle/missing-javadoc.gradle index 56ef7d4f94092..a8cab4e16f10e 100644 --- a/gradle/missing-javadoc.gradle +++ b/gradle/missing-javadoc.gradle @@ -93,8 +93,6 @@ configure([ project(":benchmarks"), project(":build-tools"), project(":build-tools:reaper"), - project(":client:benchmark"), - project(":client:client-benchmark-noop-api-plugin"), project(":client:rest-high-level"), project(":client:test"), project(":libs:opensearch-cli"), diff --git a/settings.gradle b/settings.gradle index 5c7779a2e8149..5e3b58f077053 100644 --- a/settings.gradle +++ b/settings.gradle @@ -31,8 +31,6 @@ List projects = [ 'client:rest-high-level', 'client:sniffer', 'client:test', - 'client:client-benchmark-noop-api-plugin', - 'client:benchmark', 'benchmarks', 'distribution:archives:integ-test-zip', 'distribution:archives:windows-zip', From 1678e905362b3a05315d6caccd06e7e4009a97f2 Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Wed, 27 May 2026 12:39:44 +0530 Subject: [PATCH 2/4] ci: retrigger gradle-check (flaky test in build 78356) Signed-off-by: Radhakrishnan Pachyappan From 7f6e74b6610bb20e460d54d327c9595fafa13e21 Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Wed, 27 May 2026 13:05:13 +0530 Subject: [PATCH 3/4] ci: retrigger gradle-check (systemic CI flakiness, not related to PR changes) Build 78356 and 78421 failed. Verified no remaining references to deleted modules exist anywhere in the codebase. PR #21838 (unrelated) shows the same failure/pass/failure pattern in builds 78353/78354/78380, confirming this is systemic CI flakiness. Signed-off-by: Radhakrishnan Pachyappan From a1a03ed657dab4fd9b8be88e78ccd2f33e69a7df Mon Sep 17 00:00:00 2001 From: Radhakrishnan Pachyappan Date: Wed, 27 May 2026 18:19:12 +0530 Subject: [PATCH 4/4] ci: retrigger gradle-check Signed-off-by: Radhakrishnan Pachyappan