Viktoryia Shabunia
10/08/2024, 9:02 PMNot enough merge buffer memory to execute this query. when running GroupBy queries. Below is the example of one of those queries. To address the issue, we followed the suggestion provided in the error message: we added druid.query.groupBy.maxOnDiskStorage=2gib on all historicals, broker and middlemanager in addition to increased druid.processing.buffer.sizeBytes=1gib. We want to understand the root cause of the issue, and whether we mistuned our cluster or the query is poorly created (with respect to the schema). The query below is using limitSpec and we're returning only 5 records, but we're not sure where is that limit applied, on the broker or historical level. What's the recommendation would be when we encounter the error again? We seems cannot increase the buffer size beyond 2GiB of memory, and the only thing is left is to increase the spill on disk size, which affects the performance. Any insights/recommendations will be much appreciated
{
"queryType": "groupBy",
"dataSource": {
"type": "table",
"name": "user"
},
"intervals": {
"type": "LegacySegmentSpec",
"intervals": [
"2024-09-24T23:48:12.948Z/2024-10-01T23:48:12.948Z"
]
},
"filter": {
"type": "and",
"fields": [
{
"type": "not",
"field": {
"type": "selector",
"dimension": "nativeIdPaths",
"value": null
}
},
{
"type": "not",
"field": {
"type": "selector",
"dimension": "pageId",
"value": null
}
},
{
"type": "selector",
"dimension": "pageIds",
"value": null
},
{
"type": "selector",
"dimension": "customerId",
"value": "<>"
},
{
"type": "not",
"field": {
"type": "selector",
"dimension": "isExcluded",
"value": "true"
}
}
]
},
"granularity": {
"type": "all"
},
"dimensions": [
{
"type": "LegacyDimensionSpec",
"dimension": "nativeIdPaths",
"outputName": "nativeIdPaths",
"outputType": "STRING"
},
{
"type": "LegacyDimensionSpec",
"dimension": "pageId",
"outputName": "pageId",
"outputType": "STRING"
}
],
"aggregations": [
{
"type": "count",
"name": "count"
},
{
"type": "thetaSketch",
"name": "userCount",
"fieldName": "userId",
"size": 16384
}
],
"limitSpec": {
"type": "default",
"columns": [
{
"dimension": "count",
"direction": "descending",
"dimensionOrder": {
"type": "lexicographic"
}
}
],
"limit": 5
}
}Viktoryia Shabunia
10/08/2024, 9:06 PMpageId and nativeIdPaths are multi-value fields, which are sorted using the SORTED_ARRAYBenjamin Hopp
10/08/2024, 9:46 PMthetaSketch Can you use a HLL? They will perform better and use much less memory.
{
"type": "HLLSketchBuild",
"name": "userCount",
"fieldName": "userId",
"lgK": 12,
"tgtHllType": "HLL_4",
"round": true
}Benjamin Hopp
10/08/2024, 9:49 PM"dimensionOrder": {
"type": "numeric"
}
I don't know that it will make a difference, but it can't hurt.Viktoryia Shabunia
10/08/2024, 11:16 PMBenjamin Hopp
10/08/2024, 11:19 PMBenjamin Hopp
10/08/2024, 11:20 PMViktoryia Shabunia
10/08/2024, 11:26 PMViktoryia Shabunia
10/08/2024, 11:27 PMBenjamin Hopp
10/08/2024, 11:31 PMViktoryia Shabunia
10/08/2024, 11:42 PMViktoryia Shabunia
10/08/2024, 11:42 PMViktoryia Shabunia
10/08/2024, 11:53 PMViktoryia Shabunia
10/08/2024, 11:54 PMViktoryia Shabunia
10/09/2024, 12:17 AMViktoryia Shabunia
10/09/2024, 12:18 AMquery/bytes is lower not because of HLLBenjamin Hopp
10/09/2024, 12:31 AM