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

abhishek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 468b99e608c Enable query request queuing by default when total laning 
is turned on. (#15440)
468b99e608c is described below

commit 468b99e608cfae27722606914183252e5eeafc10
Author: Abhishek Agarwal <[email protected]>
AuthorDate: Tue Jan 9 07:54:26 2024 +0530

    Enable query request queuing by default when total laning is turned on. 
(#15440)
    
    This PR enables the flag by default to queue excess query requests in the 
jetty queue. Still keeping the flag so that it can be turned off if necessary. 
But the flag will be removed in the future.
---
 docs/configuration/index.md                           |  2 +-
 docs/operations/mixed-workloads.md                    |  5 ++---
 .../druid/server/initialization/ServerConfig.java     |  6 +++---
 .../druid/server/ClientQuerySegmentWalkerTest.java    |  2 +-
 .../org/apache/druid/server/QueryResourceTest.java    |  3 ++-
 .../org/apache/druid/server/QuerySchedulerTest.java   | 19 +++++++++++--------
 .../org/apache/druid/sql/http/SqlResourceTest.java    |  5 +++--
 7 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/docs/configuration/index.md b/docs/configuration/index.md
index 3c4ef302420..d2994e8634b 100644
--- a/docs/configuration/index.md
+++ b/docs/configuration/index.md
@@ -1758,7 +1758,7 @@ Laning strategies allow you to control capacity 
utilization for heterogeneous qu
 
 |Property|Description|Default|
 |--------|-----------|-------|
-|`druid.query.scheduler.numThreads`|Maximum number of concurrently-running 
queries. When this parameter is set lower than `druid.server.http.numThreads`, 
query requests beyond the limit are denied with HTTP 429 instead of waiting in 
the Jetty request queue. This has the effect of reserving the leftover Jetty 
threads for non-query requests.<br /><br />When this parameter is set equal to 
or higher than `druid.server.http.numThreads`, it has no effect.|Unbounded|
+|`druid.query.scheduler.numThreads`|Maximum number of concurrently-running 
queries. When this parameter is set lower than `druid.server.http.numThreads`, 
query requests beyond the limit are put into the Jetty request queue. This has 
the effect of reserving the leftover Jetty threads for non-query requests.<br 
/><br />When this parameter is set equal to or higher than 
`druid.server.http.numThreads`, it has no effect.|Unbounded|
 |`druid.query.scheduler.laning.strategy`|Query laning strategy to use to 
assign queries to a lane in order to control capacities for certain classes of 
queries.|`none`|
 |`druid.query.scheduler.prioritization.strategy`|Query prioritization strategy 
to automatically assign priorities.|`manual`|
 
diff --git a/docs/operations/mixed-workloads.md 
b/docs/operations/mixed-workloads.md
index 19a4b204d83..2d2e794efc9 100644
--- a/docs/operations/mixed-workloads.md
+++ b/docs/operations/mixed-workloads.md
@@ -60,9 +60,8 @@ Set the following query laning properties in the 
`broker/runtime.properties` fil
 * `druid.query.scheduler.laning.strategy` – The strategy used to assign 
queries to lanes.
 You can use the built-in [“high/low” laning 
strategy](../configuration/index.md#highlow-laning-strategy), or [define your 
own laning strategy manually](../configuration/index.md#manual-laning-strategy).
 * `druid.query.scheduler.numThreads` – The total number of queries that can be 
served per Broker. We recommend setting this value to 1-2 less than 
`druid.server.http.numThreads`.
-:::info
- The query scheduler by default does not limit the number of queries that a 
Broker can serve. Setting this property to a bounded number limits the thread 
count. If the allocated threads are all occupied, any incoming query, including 
interactive queries, will be rejected with an HTTP 429 status code.
-:::
+
+The query scheduler by default does not limit the number of queries that a 
Broker can serve. Setting this property to a bounded number limits the thread 
count. If the allocated threads are all occupied, any incoming query, including 
interactive queries, will be queued on the broker and will timeout after the 
request stays in the queue for more than the configured timeout. This 
configured timeout is equal to `MIN(Integer.MAX_VALUE, 
druid.server.http.maxQueryTimeout)`. If the value of `dru [...]
 
 ### Lane-specific properties
 
diff --git 
a/server/src/main/java/org/apache/druid/server/initialization/ServerConfig.java 
b/server/src/main/java/org/apache/druid/server/initialization/ServerConfig.java
index 7be35469be8..4f0b99d125e 100644
--- 
a/server/src/main/java/org/apache/druid/server/initialization/ServerConfig.java
+++ 
b/server/src/main/java/org/apache/druid/server/initialization/ServerConfig.java
@@ -187,11 +187,11 @@ public class ServerConfig
   private boolean enableHSTS = false;
 
   /**
-   * This is a feature flag to enable query requests queuing when admins want 
to reserve some threads for
-   * non-query requests. This feature flag is not documented and can be 
removed in the future.
+   * This feature flag enables query requests queuing when admins want to 
reserve some threads for
+   * non-query requests. This feature flag is not documented and will be 
removed in the future.
    */
   @JsonProperty
-  private boolean enableQueryRequestsQueuing = false;
+  private boolean enableQueryRequestsQueuing = true;
 
   @JsonProperty
   private boolean showDetailedJettyErrors = true;
diff --git 
a/server/src/test/java/org/apache/druid/server/ClientQuerySegmentWalkerTest.java
 
b/server/src/test/java/org/apache/druid/server/ClientQuerySegmentWalkerTest.java
index 140b96da558..ce39f0efdcd 100644
--- 
a/server/src/test/java/org/apache/druid/server/ClientQuerySegmentWalkerTest.java
+++ 
b/server/src/test/java/org/apache/druid/server/ClientQuerySegmentWalkerTest.java
@@ -234,7 +234,7 @@ public class ClientQuerySegmentWalkerTest
         8,
         ManualQueryPrioritizationStrategy.INSTANCE,
         NoQueryLaningStrategy.INSTANCE,
-        new ServerConfig()
+        new ServerConfig(false)
     );
     initWalker(ImmutableMap.of(), scheduler);
   }
diff --git 
a/server/src/test/java/org/apache/druid/server/QueryResourceTest.java 
b/server/src/test/java/org/apache/druid/server/QueryResourceTest.java
index 6b0a2720d9d..43bce13e2c8 100644
--- a/server/src/test/java/org/apache/druid/server/QueryResourceTest.java
+++ b/server/src/test/java/org/apache/druid/server/QueryResourceTest.java
@@ -1057,7 +1057,8 @@ public class QueryResourceTest
         2,
         ManualQueryPrioritizationStrategy.INSTANCE,
         NoQueryLaningStrategy.INSTANCE,
-        new ServerConfig()
+        // enable total laning
+        new ServerConfig(false)
     );
 
     ArrayList<Future<Boolean>> back2 = new ArrayList<>();
diff --git 
a/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java 
b/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java
index 8c361e28ffe..e8443d12f7a 100644
--- a/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java
+++ b/server/src/test/java/org/apache/druid/server/QuerySchedulerTest.java
@@ -88,6 +88,8 @@ public class QuerySchedulerTest
   private static final int NUM_ROWS = 10000;
   private static final int TEST_HI_CAPACITY = 5;
   private static final int TEST_LO_CAPACITY = 2;
+  private static final ServerConfig SERVER_CONFIG_WITHOUT_TOTAL = new 
ServerConfig();
+  private static final ServerConfig SERVER_CONFIG_WITH_TOTAL = new 
ServerConfig(false);
 
   private ListeningExecutorService executorService;
   private ObservableQueryScheduler scheduler;
@@ -102,7 +104,8 @@ public class QuerySchedulerTest
         TEST_HI_CAPACITY,
         ManualQueryPrioritizationStrategy.INSTANCE,
         new HiLoQueryLaningStrategy(40),
-        new ServerConfig()
+        // Test with total laning turned on
+        SERVER_CONFIG_WITH_TOTAL
     );
   }
 
@@ -338,7 +341,7 @@ public class QuerySchedulerTest
         0,
         ManualQueryPrioritizationStrategy.INSTANCE,
         new NoQueryLaningStrategy(),
-        new ServerConfig()
+        SERVER_CONFIG_WITHOUT_TOTAL
     );
     List<Future<?>> futures = new ArrayList<>(NUM_QUERIES);
     for (int i = 0; i < NUM_QUERIES; i++) {
@@ -348,9 +351,9 @@ public class QuerySchedulerTest
   }
 
   @Test
-  public void testTotalLimitWithQueryQueuing()
+  public void testTotalLimitWithoutQueryQueuing()
   {
-    ServerConfig serverConfig = new ServerConfig();
+    ServerConfig serverConfig = SERVER_CONFIG_WITH_TOTAL;
     QueryScheduler queryScheduler = new QueryScheduler(
         serverConfig.getNumThreads() - 1,
         ManualQueryPrioritizationStrategy.INSTANCE,
@@ -361,9 +364,9 @@ public class QuerySchedulerTest
   }
 
   @Test
-  public void testTotalLimitWithouQueryQueuing()
+  public void testTotalLimitWithQueryQueuing()
   {
-    ServerConfig serverConfig = new ServerConfig(true);
+    ServerConfig serverConfig = SERVER_CONFIG_WITHOUT_TOTAL;
     QueryScheduler queryScheduler = new QueryScheduler(
         serverConfig.getNumThreads() - 1,
         ManualQueryPrioritizationStrategy.INSTANCE,
@@ -380,7 +383,7 @@ public class QuerySchedulerTest
         5,
         ManualQueryPrioritizationStrategy.INSTANCE,
         new NoQueryLaningStrategy(),
-        new ServerConfig()
+        SERVER_CONFIG_WITH_TOTAL
     );
 
     QueryRunnerFactory factory = GroupByQueryRunnerTest.makeQueryRunnerFactory(
@@ -859,7 +862,7 @@ public class QuerySchedulerTest
     Injector injector = GuiceInjectors.makeStartupInjectorWithModules(
         ImmutableList.of(
             binder -> {
-              binder.bind(ServerConfig.class).toInstance(new ServerConfig());
+              
binder.bind(ServerConfig.class).toInstance(SERVER_CONFIG_WITH_TOTAL);
               binder.bind(ServiceEmitter.class).toInstance(new 
ServiceEmitter("test", "localhost", new NoopEmitter()));
               JsonConfigProvider.bind(binder, "druid.query.scheduler", 
QuerySchedulerProvider.class, Global.class);
             }
diff --git a/sql/src/test/java/org/apache/druid/sql/http/SqlResourceTest.java 
b/sql/src/test/java/org/apache/druid/sql/http/SqlResourceTest.java
index 2f3a044a657..aca833540b2 100644
--- a/sql/src/test/java/org/apache/druid/sql/http/SqlResourceTest.java
+++ b/sql/src/test/java/org/apache/druid/sql/http/SqlResourceTest.java
@@ -205,7 +205,8 @@ public class SqlResourceTest extends CalciteTestBase
         5,
         ManualQueryPrioritizationStrategy.INSTANCE,
         new HiLoQueryLaningStrategy(40),
-        new ServerConfig()
+        // Enable total laning
+        new ServerConfig(false)
     )
     {
       @Override
@@ -1613,7 +1614,7 @@ public class SqlResourceTest extends CalciteTestBase
   }
 
   @Test
-  public void testTooManyRequests() throws Exception
+  public void testTooManyRequestsAfterTotalLaning() throws Exception
   {
     final int numQueries = 3;
     CountDownLatch queriesScheduledLatch = new CountDownLatch(numQueries - 1);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to