You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by tf...@apache.org on 2023/06/30 17:20:20 UTC

[solr] branch main updated: SOLR-16702 SimpleSearch benchmark compares http1 vs http2 (#1731)

This is an automated email from the ASF dual-hosted git repository.

tflobbe pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 1a06b3a455c SOLR-16702 SimpleSearch benchmark compares http1 vs http2 (#1731)
1a06b3a455c is described below

commit 1a06b3a455cb3588e8357a9ddd23c96de6ab4e9e
Author: Alex <st...@apache.org>
AuthorDate: Fri Jun 30 10:20:14 2023 -0700

    SOLR-16702 SimpleSearch benchmark compares http1 vs http2 (#1731)
    
    The test catches errors and outputs the total instead of failing. This doesn't solve the problem we are hitting with http2, but should help diagnose and fix
---
 .../org/apache/solr/bench/search/SimpleSearch.java | 100 +++++++++++++++++++--
 1 file changed, 93 insertions(+), 7 deletions(-)

diff --git a/solr/benchmark/src/java/org/apache/solr/bench/search/SimpleSearch.java b/solr/benchmark/src/java/org/apache/solr/bench/search/SimpleSearch.java
index b4c1aa7c261..165d68ecb3b 100644
--- a/solr/benchmark/src/java/org/apache/solr/bench/search/SimpleSearch.java
+++ b/solr/benchmark/src/java/org/apache/solr/bench/search/SimpleSearch.java
@@ -17,6 +17,8 @@
 package org.apache.solr.bench.search;
 
 import java.io.IOException;
+import java.util.concurrent.atomic.AtomicLong;
+import org.apache.solr.bench.BaseBenchState;
 import org.apache.solr.bench.MiniClusterState;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
@@ -26,11 +28,14 @@ import org.openjdk.jmh.annotations.Benchmark;
 import org.openjdk.jmh.annotations.Fork;
 import org.openjdk.jmh.annotations.Level;
 import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Param;
 import org.openjdk.jmh.annotations.Scope;
 import org.openjdk.jmh.annotations.Setup;
 import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
 import org.openjdk.jmh.annotations.Threads;
 import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.infra.Blackhole;
 
 @Fork(value = 1)
 @Warmup(time = 5, iterations = 9)
@@ -43,18 +48,23 @@ public class SimpleSearch {
   @State(Scope.Benchmark)
   public static class BenchState {
 
+    @Param({"false", "true"})
+    boolean useHttp1;
+
+    @Param({"false"})
+    boolean strict;
+
+    AtomicLong total = new AtomicLong();
+    AtomicLong err = new AtomicLong();
+
     QueryRequest q = new QueryRequest(new SolrQuery("q", "id:0")); // no match is OK
 
     @Setup(Level.Trial)
     public void setupTrial(MiniClusterState.MiniClusterBenchState miniClusterState)
         throws Exception {
-      miniClusterState.setUseHttp1(true);
+      miniClusterState.setUseHttp1(useHttp1);
       miniClusterState.startMiniCluster(1);
       miniClusterState.createCollection(COLLECTION, 1, 1);
-
-      //      Docs docs = Docs.docs().field("id", integers().incrementing());
-
-      //      miniClusterState.index(COLLECTION, docs, 30 * 1000);
       String base = miniClusterState.nodes.get(0);
       q.setBasePath(base);
     }
@@ -66,13 +76,89 @@ public class SimpleSearch {
       CollectionAdminRequest.Reload reload = CollectionAdminRequest.reloadCollection(COLLECTION);
       reload.setBasePath(miniClusterState.nodes.get(0));
       miniClusterState.client.request(reload);
+
+      total = new AtomicLong();
+      err = new AtomicLong();
+    }
+
+    @TearDown(Level.Iteration)
+    public void teardownIt() {
+      if (err.get() > 0) {
+        BaseBenchState.log(
+            "Completed Iteration with " + total.get() + " queries and " + err.get() + " errors");
+      }
     }
   }
 
+  /**
+   * Under high load http2 client could throw the below exception
+   *
+   * <pre>{@code
+   * org.apache.solr.client.solrj.SolrServerException: IOException occurred when talking to server at: http://127.0.0.1:49436/solr/c1/select?q=id%3A0&wt=javabin&version=2
+   * at org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:533)
+   * at org.apache.solr.bench.search.SimpleSearch.query(SimpleSearch.java:89)
+   * at org.apache.solr.bench.search.jmh_generated.SimpleSearch_query_jmhTest.query_thrpt_jmhStub(SimpleSearch_query_jmhTest.java:275)
+   * at org.apache.solr.bench.search.jmh_generated.SimpleSearch_query_jmhTest.query_Throughput(SimpleSearch_query_jmhTest.java:127)
+   * at jdk.internal.reflect.GeneratedMethodAccessor8.invoke(Unknown Source)
+   * at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
+   * at java.base/java.lang.reflect.Method.invoke(Method.java:566)
+   * at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:475)
+   * at org.openjdk.jmh.runner.BenchmarkHandler$BenchmarkTask.call(BenchmarkHandler.java:458)
+   * at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
+   * at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
+   * at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
+   * at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
+   * at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
+   * at java.base/java.lang.Thread.run(Thread.java:829)
+   * Caused by: java.io.IOException: cancel_stream_error
+   * at org.eclipse.jetty.http2.client.http.HttpReceiverOverHTTP2.onReset(HttpReceiverOverHTTP2.java:202)
+   * at org.eclipse.jetty.http2.client.http.HttpChannelOverHTTP2$Listener.onReset(HttpChannelOverHTTP2.java:206)
+   * at org.eclipse.jetty.http2.api.Stream$Listener.onReset(Stream.java:271)
+   * at org.eclipse.jetty.http2.HTTP2Stream.notifyReset(HTTP2Stream.java:853)
+   * at org.eclipse.jetty.http2.HTTP2Stream.onReset(HTTP2Stream.java:563)
+   * at org.eclipse.jetty.http2.HTTP2Stream.process(HTTP2Stream.java:392)
+   * at org.eclipse.jetty.http2.HTTP2Session.onReset(HTTP2Session.java:320)
+   * at org.eclipse.jetty.http2.parser.Parser$Listener$Wrapper.onReset(Parser.java:367)
+   * at org.eclipse.jetty.http2.parser.BodyParser.notifyReset(BodyParser.java:139)
+   * at org.eclipse.jetty.http2.parser.ResetBodyParser.onReset(ResetBodyParser.java:92)
+   * at org.eclipse.jetty.http2.parser.ResetBodyParser.parse(ResetBodyParser.java:61)
+   * at org.eclipse.jetty.http2.parser.Parser.parseBody(Parser.java:193)
+   * at org.eclipse.jetty.http2.parser.Parser.parse(Parser.java:122)
+   * at org.eclipse.jetty.http2.HTTP2Connection$HTTP2Producer.produce(HTTP2Connection.java:278)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produceTask(AdaptiveExecutionStrategy.java:450)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:243)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:194)
+   * at org.eclipse.jetty.http2.HTTP2Connection.produce(HTTP2Connection.java:208)
+   * at org.eclipse.jetty.http2.HTTP2Connection.onFillable(HTTP2Connection.java:155)
+   * at org.eclipse.jetty.http2.HTTP2Connection$FillableCallback.succeeded(HTTP2Connection.java:378)
+   * at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
+   * at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
+   * at org.eclipse.jetty.util.thread.Invocable.invokeNonBlocking(Invocable.java:151)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.invokeAsNonBlocking(AdaptiveExecutionStrategy.java:433)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:375)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
+   * at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:194)
+   * at org.apache.solr.common.util.ExecutorUtil$MDCAwareThreadPoolExecutor.lambda$execute$0(ExecutorUtil.java:289)
+   * ... 3 more
+   * }</pre>
+   */
   @Benchmark
   public Object query(
-      BenchState benchState, MiniClusterState.MiniClusterBenchState miniClusterState)
+      BenchState benchState, MiniClusterState.MiniClusterBenchState miniClusterState, Blackhole bh)
       throws SolrServerException, IOException {
-    return miniClusterState.client.request(benchState.q, COLLECTION);
+    if (benchState.strict) {
+      return miniClusterState.client.request(benchState.q, COLLECTION);
+    }
+
+    // non strict run ignores exceptions
+    try {
+      return miniClusterState.client.request(benchState.q, COLLECTION);
+    } catch (SolrServerException e) {
+      bh.consume(e);
+      benchState.err.getAndIncrement();
+      return null;
+    } finally {
+      benchState.total.getAndIncrement();
+    }
   }
 }