This is an automated email from the ASF dual-hosted git repository.
vvivekiyer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new f7b9a259844 [Query Resource Isolation] Additonal Sampling for Broker
and Server (#16164)
f7b9a259844 is described below
commit f7b9a25984467cd884cd9a52c0ab9f79d4cba5e5
Author: Praveen <[email protected]>
AuthorDate: Fri Jul 25 16:04:43 2025 -0700
[Query Resource Isolation] Additonal Sampling for Broker and Server (#16164)
* fix
* sampling
* Broker sampling
* revert integ-test
* Fix test failures
* review comments
* remove MSE
* broker auth
* remove per pruner & planner sample
---
.../broker/requesthandler/BaseSingleStageBrokerRequestHandler.java | 7 +++++++
.../pinot/core/query/executor/ServerQueryExecutorV1Impl.java | 4 ++++
2 files changed, 11 insertions(+)
diff --git
a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
index d9a1e365ead..78b8d4b4040 100644
---
a/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
+++
b/pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java
@@ -400,6 +400,8 @@ public abstract class BaseSingleStageBrokerRequestHandler
extends BaseBrokerRequ
// full request compile time = compilationTimeNs + parserTimeNs
_brokerMetrics.addPhaseTiming(rawTableName,
BrokerQueryPhase.REQUEST_COMPILATION,
(compilationEndTimeNs - compilationStartTimeNs) +
sqlNodeAndOptions.getParseTimeNs());
+ // Accounts for resource usage of the compilation phase, since compilation
for some queries can be expensive.
+ Tracing.ThreadAccountantOps.sampleAndCheckInterruption();
// Second-stage table-level access control
// TODO: Modify AccessControl interface to directly take PinotQuery
@@ -439,6 +441,8 @@ public abstract class BaseSingleStageBrokerRequestHandler
extends BaseBrokerRequ
_brokerMetrics.addPhaseTiming(rawTableName,
BrokerQueryPhase.AUTHORIZATION,
System.nanoTime() - compilationEndTimeNs);
+ // Accounts for resource usage of the authorization phase.
+ Tracing.ThreadAccountantOps.sampleAndCheckInterruption();
if (!authorizationResult.hasAccess()) {
throwAccessDeniedError(requestId, query, requestContext, tableName,
authorizationResult);
@@ -687,6 +691,9 @@ public abstract class BaseSingleStageBrokerRequestHandler
extends BaseBrokerRequ
long routingEndTimeNs = System.nanoTime();
_brokerMetrics.addPhaseTiming(rawTableName, BrokerQueryPhase.QUERY_ROUTING,
routingEndTimeNs - routingStartTimeNs);
+ // Account the resource used for routing phase, since for single stage
queries with multiple segments, routing
+ // can be expensive.
+ Tracing.ThreadAccountantOps.sampleAndCheckInterruption();
// Set timeout in the requests
long timeSpentMs = TimeUnit.NANOSECONDS.toMillis(routingEndTimeNs -
compilationStartTimeNs);
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
b/pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
index 97ee75dedb4..d63710dd3ff 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/query/executor/ServerQueryExecutorV1Impl.java
@@ -313,6 +313,8 @@ public class ServerQueryExecutorV1Impl implements
QueryExecutor {
TableExecutionInfo.SelectedSegmentsInfo selectedSegmentsInfo =
executionInfo.getSelectedSegmentsInfo(queryContext, timerContext,
executorService, _segmentPrunerService);
+ // Account for resource usage in pruning, given that it can be expensive
for large segment lists.
+ Tracing.ThreadAccountantOps.sampleAndCheckInterruption();
InstanceResponseBlock instanceResponse =
execute(selectedSegmentsInfo.getIndexSegments(), queryContext,
timerContext, executorService, streamer,
@@ -580,6 +582,8 @@ public class ServerQueryExecutorV1Impl implements
QueryExecutor {
}
InstanceResponseBlock instanceResponse;
Plan queryPlan = planCombineQuery(queryContext, timerContext,
executorService, streamer, selectedSegmentContexts);
+ // Sample to track usage of query planning, since it can be expensive for
large segment lists.
+ Tracing.ThreadAccountantOps.sampleAndCheckInterruption();
TimerContext.Timer planExecTimer =
timerContext.startNewPhaseTimer(ServerQueryPhase.QUERY_PLAN_EXECUTION);
instanceResponse = queryPlan.execute();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]