Memory usage keeps increasing after GROUP BY on a multi-value attribute and is not released
Bug description
I was able to reproduce this behavior in a very exaggerated but consistent way. After running these queries, the memory allocated by Manticore is not released inside the container.
First, populate the table with test data:
manticore-load \
--host=127.0.0.1 \
--port=9306 \
--drop \
--wait \
--threads=1 \
--batch-size=20 \
--total=10000 \
--cache-from-disk \
--init="CREATE TABLE mva_repro (
category_id int,
pc_car_ids multi
)" \
--load="INSERT INTO mva_repro (
id,
category_id,
pc_car_ids
) VALUES (
<increment>,
704,
(<array/77725/77725/1/2000000000>)
)"Then repeatedly execute the following query:
SELECT GROUPBY() AS pc_car_id
FROM mva_repro
WHERE category_id = 704
GROUP BY pc_car_ids
ORDER BY pc_car_id ASC
LIMIT 999999
OPTION max_matches = 100000;The result is that memory usage keeps increasing after every execution of the query and never decreases afterwards.
Memory consumption continues to grow until Manticore is restarted.
Initial state
No queries have been executed yet, only the Manticore container is running:
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
648a2de55f6e gitlab-manticore-1 0.37% 932.7MiB / 28GiB 3.25% 8.25kB / 3.5kB 4.64GB / 8.19kB 19After the first query
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
648a2de55f6e gitlab-manticore-1 0.44% 3.836GiB / 28GiB 13.70% 10.7kB / 102kB 4.64GB / 12.3kB 19After the second query
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
648a2de55f6e gitlab-manticore-1 0.38% 6.67GiB / 28GiB 23.82% 11.6kB / 200kB 4.64GB / 12.3kB 19After the third query
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
648a2de55f6e gitlab-manticore-1 0.39% 9.535GiB / 28GiB 34.05% 12.9kB / 298kB 4.66GB / 12.3kB 19And it continues growing in the same way with every subsequent query execution, until Manticore is restarted.
Manticore Search version
29.9.0, 25.0.0
Operating system version
Docker
Have you tried the latest development version?
Yes — the issue still occurs
How does this bug affect you?
Production is down or this is a major incident
How do you use Manticore Search?
We use Manticore Search in an e-commerce project with an index containing approximately 16 million documents.
It works very well for full-text search and filtering, but we are experiencing problems when using it for aggregations like the one described in this issue.
What do you use Manticore for?
Full text searching and filtering.
Company or project
academy
Approximate scale
~30M products
Can we learn more about your use case?
- Yes — feel free to @mention me in this issue if you'd like to ask more about how we use Manticore.
Internal Checklist
To be completed by the assignee. Check off tasks that have been completed or are not applicable.
- Implementation completed
- Tests developed
- Documentation updated
- Documentation reviewed
Source: manticoresoftware/manticoresearch