Hey , running druid 27.0.0 , executing query for 1...
# troubleshooting
n
Hey , running druid 27.0.0 , executing query for 1 month interval , with single split .. after all configuration changes I did , broker is crash and restart with out of memory exception .. the setup is host momory - 16g JAVA-OPT - “-Xms8g -Xmx8g -XX:MaxDirectMemorySize=4g druid_processing_directMemorySize - 2500000000 (2.5G)
Copy code
druid_query_groupBy_maxResults=500000
druid_query_groupBy_maxIntermediateRows=1000000
druid_query_groupBy_maxMergingDictionarySize=268435456
what can be the cause broker is crashing .. , how can I trouble shot this to figure out what I need to do to fix it ? can be that broker is not using the direct memory and instead keep using the heap memory ? broker status paylodd “memory”: { “maxMemory”: 8589934592, “totalMemory”: 8589934592, “freeMemory”: 6974955008, “usedMemory”: 1614979584, “directMemory”: 4294967296 }
when qury runs .. the status is “memory”: { “maxMemory”: 8589934592, “totalMemory”: 8589934592, “freeMemory”: 18888512, “usedMemory”: 8571046080, “directMemory”: 4294967296
j
How many segment files does your query load?
On an 8 core, 32 GB RAM machine, here's a config that works for us:
Copy code
# HTTP server settings
druid.server.http.numThreads=60
druid.server.http.maxSubqueryRows=100000
druid.server.http.maxIdleTime=PT10M

# Query prioritization and laning
druid.query.scheduler.numThreads=50

# HTTP client settings
druid.broker.http.numConnections=50
druid.broker.http.maxQueuedBytes=10000000

# Processing threads and buffers
druid.processing.buffer.sizeBytes=1000000000
druid.processing.numMergeBuffers=2
druid.processing.numThreads=4
druid.processing.tmpDir=var/druid/processing

# Query cache disabled -- push down caching and merging instead
druid.broker.cache.useCache=false
druid.broker.cache.populateCache=false

# Group By Query Tuning
druid.query.groupBy.maxMergingDictionarySize=1073741824
druid.query.groupBy.maxOnDiskStorage=0
druid.sql.planner.requireTimeCondition=false
Here's our JVM config BTW
Copy code
-server
-Xms16g
-Xmx16g
-XX:MaxDirectMemorySize=16g
-XX:+ExitOnOutOfMemoryError
-XX:+UseG1GC
-Duser.timezone=UTC
-Dfile.encoding=UTF-8
-Djava.io.tmpdir=var/tmp
-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
-Dservice=broker
For you, I would start by increasing your
MaxDirectMemorySize
. Druid uses a LOT of that.
I'm also curious about your underscores in your config. Check that this isn't a typo...
n
Thanks you , will try to extend maxDirectMemory , the config underscore is there as deployment is docker env
j
FYI - from the config guide:
Copy code
The amount of direct memory needed by Druid is at least druid.processing.buffer.sizeBytes * (druid.processing.numMergeBuffers + druid.processing.numThreads + 1). You can ensure at least this amount of direct memory is available by providing -XX:MaxDirectMemorySize=<VALUE> in druid.indexer.runner.javaOptsArray as documented above.
Assuming you have 4 cores your default values would end up being:
Copy code
druid.processing.buffer.sizeBytes = auto (max: 1GiB)
druid.processing.numMergeBuffers = 2
druid.processing.numThreads = 3
Total: max 6 GiB The documentation on
druid.processing.buffer.sizeBytes
states the size is automatically determined to a maximum of 1GiB. We set ours a little bit lower than that maximum because we found that the calculation from the documentation requires some additional headroom. You may want to consider as well. But the primary thing is to set the MaxDirectMemorySize based on the above.
The
numMergeBuffers
is needed for the groupBy queries. We found that 2 works. We decreased
numThreads
to fit the memory available.
n
+ what the impcat downside of seting useCashe to false / puplateCase to false ., on my current config is true .. ?
j
I've not tested it but based on the description I would rather push the work down to my data nodes as those are bigger and we have more of them.
That's worth testing. Let me know if you see a benefit 🙂
n
sure , thanks!!
j
The default is false BTW
Oh wait, there's a note:
Copy code
Note: Even if cache is enabled, for groupBy queries, segment level cache does not work on Brokers. See Query caching for more information.
🙌 1
I got curious and checked the cache on our historical nodes. We have it set as:
Copy code
# Query cache
druid.historical.cache.useCache=true
druid.historical.cache.populateCache=true
druid.cache.type=caffeine
druid.cache.sizeInBytes=2000000000
n
@JRob - update from me side .. for 16G host I set
Copy code
- Name: JAVA_OPTS
  Value: "-Xms10g -Xmx10g -XX:MaxDirectMemorySize=5g -XX:+UseG1GC"
and set useCache / populateCache both to false with this setup query working , broker is not crash with out-of-memory excetption
🙌 1