Besides hilo query laning is there any other way t...
# troubleshooting
j
Besides hilo query laning is there any other way to prevent really expensive queries from impacting the cluster?
k
threshold based prioritisation can help here - depends on your definition of "expensive" https://medium.com/@kyle.hoondert/query-prioritization-in-apache-druid-79f2023fc1f2
j
How about also Broker/Data Tiering?
m
Something like this (WIP) can help too
j
Thanks!!! 🍻
Regarding 18148, this is exactly what I was thinking. It's nice to lane it at the broker level but some queries can be so expensive that even one will slow down all other queries without some laning on the data nodes as well. Also, does the
priority
matter when hilo is used? Should I also be decrementing the
priority
using
druid.query.scheduler.prioritization.adjustment
?
j
m
there is no lane on historical but historical uses a priority queue. So a high priority query can jump to the front of the queue. The only problem with that is there is no preemptively. So if the current segment processing is taking a long time (i.e. as long as the query timeout which for us is 5 minutes) then even if the high priority jumped to the front of the queue, it would be stuck waiting for a really long time
👀 1
j
The default
druid.query.scheduler.prioritization.adjustment
is
none
. However, the
hilo
strategy still moves large queries into the "low" lane. So it looks like priority is ignore with
hilo
strategy? I guess my question is should I also be using
adjustment
with
hilo
or will the default of
none
work all the same?
@Maytas Monsereenusorn I understand there's no preempting but what about large queries that request a large number of segments? Will higher priority requests jump in between? For example, I have two requests; a low priority one needs to open ~72,000 segment files and a high priority one that needs to open 10 segment files. The low priority one executes first. Will the high priority request be blocked until all 72,000 segment files are processed by the lower priority request or is there an opportunity to jump the queue?
Related: Is there a way to queue expensive queries rather than returning a 429?
m
The default
druid.query.scheduler.prioritization.adjustment
is
none
. However, the
hilo
strategy still moves large queries into the “low” lane. So it looks like priority is ignore with
hilo
strategy?
I guess my question is should I also be using
adjustment
with
hilo
or will the default of
none
work all the same?
There are two strategies here. One is for prioritization strategy, druid.query.scheduler.prioritization.strategy. This is how the priority is adjusted and the other one is for Laning strategies, druid.query.scheduler.laning.strategy. This is how Druid creates/maintains lane for query on the broker. druid.query.scheduler.prioritization.adjustment is related to the prioritization strategy and hilo is related to the Laning strategies. They are kinda different things
I understand there’s no preempting but what about large queries that request a large number of segments? Will higher priority requests jump in between?
For example, I have two requests; a low priority one needs to open ~72,000 segment files and a high priority one that needs to open 10 segment files. The low priority one executes first. Will the high priority request be blocked until all 72,000 segment files are processed by the lower priority request or is there an opportunity to jump the queue?
higher priority requests jumps to the front of the queue (I think). If each of the individual segment processing for the large query is slow, then the higher priority requests will have to wait for that
> Related: Is there a way to queue expensive queries rather than returning a 429? I don’t think that is possible with hilo Laning strategy
j
Thank you. I will switch to threshold strategy and perform some tests...
Incongruent with the documentation which says there is no default
druid.query.scheduler.prioritization.adjustment
I discovered that the default value is 5.
😎 1
If anyone is interested in my threshold testing results... Broker Configuration used:
Copy code
# Query prioritization and laning
druid.query.scheduler.numThreads=50
druid.query.scheduler.prioritization.strategy=threshold
druid.query.scheduler.prioritization.segmentCountThreshold=200
druid.query.scheduler.prioritization.adjustment=5
Test parameters: • Heavy query is defined as > 200 segments and typically taking ~20 seconds to execute • Light query is defined as < 10 segments and typically taking ~0.2 seconds to execute Test A ------- I execute 5 heavy and 3 light queries in sequence, about 1 second apart. Query Response Times (without threshold config): 1. 18.80s 2. 29.00s 3. 38.75s 4. 50.19s 5. 50.86s 6. 12.48s (light query) 7. 18.73s (light query) 8. 21.01s (light query) 9. Average heavy query: 38s 10. Average light query: 17s Query Response Times With Threshold Config: 1. 19.60s 2. 27.84s 3. 36.92s 4. 46.18s 5. 45.54s 6. 12.87s (light query) 7. 11.82s (light query) 8. 10.86s (light query) 9. Average heavy query: 35s 10. Average light query: 12s Executed several times in a row I get fairly consistent results with the above. It's obvious how much the impact heavy queries have on lighter queries. That said, taking into account some variation for execution times, the threshold parameters reduce the query times by about 5 seconds which is 40% faster than without threshold prioritization strategy. Test B ------- I execute 4 heavy and 4 light queries alternating. Again in sequence, about 1 second apart. Query Response Times (without threshold config): 1. 18.58s 2. 7.72s (light query) 3. 24.85s 4. 14.67s (light query) 5. 31.48s 6. 12.34s (light query) 7. 30.15s 8. 17.61s (light query) 9. Average heavy query: 26s 10. Average light query: 13s Query Response Times With Threshold Config: 1. 20.02s 2. 1.75s (light query) 3. 28.93s 4. 1.11s (light query) 5. 35.61s 6. 0.95s (light query) 7. 33.98s 8. 0.68s (light query) 9. Average heavy query: 30s 10. Average light query: 4s Conclusion: The threshold configuration allows the lighter queries to respond closer to their typical response times, as long is there aren't too many heavy queries executing close ahead of them. I'm interested to see how this behaves in a production environment with mixed workload.