For comprehensive configuration details, see the Configuration Reference. For specific tuning questions, consult the Druid community.
Historical Tuning
Historicals are the workhorses of query processing, serving data from segments stored on disk.Heap Sizing
The primary contributors to Historical heap usage:Query Results
Partial unmerged query results from segments
Lookups
Stored maps for lookup tables
(0.5 GiB × number of CPU cores)
- Basic Configuration
- With Lookups
- With Cache
Processing Threads and Buffers
Number of processing threads for query execution.
- Too low: CPU underutilization
- Too high: CPU contention
- Recommended:
number of cores - 1
Size of off-heap buffers for processing. Larger buffers allow more data to be processed in a single pass.Recommended: 500MiB - 1GiB
Buffers for merging GroupBy query results.Recommended:
numThreads ÷ 4 (1:4 ratio)Direct Memory Sizing
Calculate required direct memory:Example Calculation
Example Calculation
+1 accounts for segment decompression buffers.Connection Pool
HTTP server threads for handling requests.Formula: Slightly higher than sum of
druid.broker.http.numConnections across all BrokersSegment Cache
Storage Recommendations
Use SSDs for Historical storage to minimize segment load times and improve query performance.
Broker Tuning
Brokers merge results from Historicals and route queries.Heap Sizing
Broker heap usage scales with:
Recommendations:
- Small/Medium clusters (~15 servers): 4-8 GiB
- Large clusters (~100 servers): 30-60 GiB
Processing Configuration
Brokers typically don’t need processing threads (merge happens on-heap), but do need merge buffers:(numMergeBuffers + 1) × buffer.sizeBytes
Connection Pool
Outgoing connections per Historical/Task. This limits concurrent queries the Broker can process.
Incoming HTTP request threads. Should be slightly higher than
numConnections.Backpressure
Maximum buffer size for queued unread data from Historicals/Tasks.Formula:
≈ 2MiB × number of HistoricalsBroker Count
General guideline: 1 Broker per 15 Historicals (minimum 2 for HA)MiddleManager Tuning
MiddleManagers launch Task processes for ingestion.MiddleManager Configuration
Maximum number of concurrent Tasks this MiddleManager can run.
Task Configuration
- Heap
- Processing
- Connection Pool
(numThreads + numMergeBuffers + 1) × buffer.sizeBytes
Total MiddleManager Memory
Use SSDs for MiddleManager storage for faster segment building and merging.
Coordinator Tuning
Heap Sizing
Coordinator heap scales with:- Number of servers
- Number of segments
- Number of tasks
Dynamic Configuration
Percentage of segments to consider when looking for segments to move.
- 100: Consider all segments (default, slower)
- 66: Consider top 66% (faster, recommended starting point)
- 25: Consider top 25% (much faster, more aggressive)
Overlord Tuning
Overlord heap scales primarily with the number of running tasks. Recommendation: 25-50% of Coordinator heapRouter Tuning
Router has minimal resource requirements.JVM Tuning
Garbage Collection
Shenandoah and ZGC are recommended for heaps > 24GB to minimize pause times.
Essential JVM Flags
System Configuration
Linux Limits
- File Descriptors
- Memory Maps
Edit
/etc/security/limits.conf:Swap Space
Storage
Use SSDs
Essential for Historicals and MiddleManagers
JBOD vs RAID
JBOD can provide better throughput than software RAID
Additional Optimizations
Mount /tmp on tmpfs
Avoid GC pauses from JVM statistics. See The Four Month Bug.
Separate GC logs from data
Write GC and Druid logs to different disks than data on disk-intensive processes.
Monitoring and Validation
Key metrics to monitor after tuning:
- Query latency (
query/time) - GC pause time (
jvm/gc/time) - Thread pool utilization (
jetty/threadPool/utilizationRate) - Segment scan queue (
segment/scan/pending) - Ingestion lag (Kafka/Kinesis specific)