leventov commented on a change in pull request #6629: Add support parallel
combine in brokers
URL: https://github.com/apache/incubator-druid/pull/6629#discussion_r242156826
##########
File path: processing/src/main/java/org/apache/druid/query/QueryContexts.java
##########
@@ -174,6 +179,35 @@
}
}
+ private static int checkPositive(String propertyName, int val)
+ {
+ Preconditions.checkArgument(
+ val > 0,
+ "%s should be positive, but [%s]",
+ propertyName,
+ val
+ );
+ return val;
+ }
+
+ /**
+ * Return the configured number of combine threads if any. Others {@link
#NO_PARALLEL_COMBINE_THREADS}.
+ */
+ public static <T> int getNumBrokerParallelCombineThreads(Query<T> query)
+ {
+ return parseInt(query, NUM_BROKER_PARALLEL_COMBINE_THREADS,
NO_PARALLEL_COMBINE_THREADS);
Review comment:
It's essentially impossible to set `NUM_BROKER_PARALLEL_COMBINE_THREADS`
"right" even if it is done on query per query basis, that will nobody ever do.
This moment broker could be idle, the next moment a lot of queries will arrive
and setting `NUM_BROKER_PARALLEL_COMBINE_THREADS` will only make things worse.
> because automatic optimization might be wrong or not enough
My intention to employ techniques from ForkJoinPool. When you use
`parallelStream()`, it basically could not parallelize wrong or not enough. It
may not be 100% optimal because of coarse partitioning granularity (You could
only split any piece of work in two parts, not three, for example), but it is
always within 10-20% from optimum. And this actually should not be so for
combine on brokers.
The only way to really abuse `parallelStream()` is to pass it something that
could be completed in less than 10ms. But it could be safely avoided in
parallel combine too, as I shown above.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]