Open akissa opened 6 years ago
I can confirm that the same issue is evident when using manticore-2.6.3-180328-cccb538-release-stemmer-rhel6-bin.rpm
It seems to be caused by infix indexing, min_infix_len
when disabled the memory and cpu usage does not sky rocket.
infix builder that got enabled with min_infix_len
option does not constrain memory limit option.
Could you provide result size of index files? (ls -lh /var/lib/manticore/messages*)
I have disabled infix indexing on the instance with 75k records and reindexed. The data below is from an instance with 46k records.
ls -lh /var/lib/manticore/messages*
-rw-r--r-- 1 manticore manticore 1.6M Apr 10 09:18 /var/lib/manticore/messages.spa
-rw-r--r-- 1 manticore manticore 32M Apr 10 09:18 /var/lib/manticore/messages.spd
-rw-r--r-- 1 manticore manticore 187K Apr 10 09:18 /var/lib/manticore/messages.spe
-rw-r--r-- 1 manticore manticore 561 Apr 10 09:18 /var/lib/manticore/messages.sph
-rw-r--r-- 1 manticore manticore 16M Apr 10 09:18 /var/lib/manticore/messages.spi
-rw-r--r-- 1 manticore manticore 0 Apr 10 09:18 /var/lib/manticore/messages.spk
-rw------- 1 manticore manticore 0 Apr 10 09:18 /var/lib/manticore/messages.spl
-rw-r--r-- 1 manticore manticore 0 Apr 10 09:18 /var/lib/manticore/messages.spm
-rw-r--r-- 1 manticore manticore 25M Apr 10 09:18 /var/lib/manticore/messages.spp
-rw-r--r-- 1 manticore manticore 1 Apr 10 09:18 /var/lib/manticore/messages.sps
Sorry the above had infix indexing disabled. Below is same instance 46k records with infix enabled.
ls -lh /var/lib/manticore/messages*
-rw-r--r-- 1 manticore manticore 1.6M Apr 10 09:32 /var/lib/manticore/messages.spa
-rw-r--r-- 1 manticore manticore 63M Apr 10 09:34 /var/lib/manticore/messages.spd
-rw-r--r-- 1 manticore manticore 375K Apr 10 09:34 /var/lib/manticore/messages.spe
-rw-r--r-- 1 manticore manticore 561 Apr 10 09:34 /var/lib/manticore/messages.sph
-rw-r--r-- 1 manticore manticore 155M Apr 10 09:34 /var/lib/manticore/messages.spi
-rw-r--r-- 1 manticore manticore 0 Apr 10 09:32 /var/lib/manticore/messages.spk
-rw------- 1 manticore manticore 0 Apr 10 09:34 /var/lib/manticore/messages.spl
-rw-r--r-- 1 manticore manticore 0 Apr 10 09:32 /var/lib/manticore/messages.spm
-rw-r--r-- 1 manticore manticore 49M Apr 10 09:34 /var/lib/manticore/messages.spp
-rw-r--r-- 1 manticore manticore 1 Apr 10 09:34 /var/lib/manticore/messages.sps
Added to backlog, thank you
➤ Aleksey N. Vinogradov commented:
This thing first need to be discussed. We actually have several places in index building where mem limit is not honored. Moreover, it is honored only manually, on the places where we ourselves calculate the consumption, and all other things underneath may be still greedy.
Reworking is possible, but due to different arch inside it is not a 'bug' but quite essential refactor. In spite of coming v.3 it is not clear whether v.2 worth it or not (since AFAIK build index procedure is quite reworked in v.3 and may be already solved the issue). Just want to avoid time-wasting on the things which possible will be deprecated and leaved in months. Don't know about real plans for v.3 releasing and details of indexing, m.b. @glook may tell more comprehensive story about last.
As a side note: we may try to make a kind of 'high-tech' cheat by making tiny trampoline script/app which will create mem-limited cgroup and put indexer worker there.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Feel free to re-open the issue in case it becomes actual.
Still actual
Just adding my findings to the discussion. I hit a FATAL: out of memory
error with the indexer despite having 100MB of available RAM and mem_limit
set to 64MB. I am using plain indexes. I discovered that the excessive RAM usage was related to the fact that I was indexing multiple indexes in a single command.
With mem_limit
set to 64MB, I got:
indexer --sighup-each --rotate cmn_main_index deu_main_index eng_main_index fra_main_index gos_main_index heb_main_index jpn_main_index lez_main_index lfn_main_index oci_main_index ood_main_index spa_main_index vie_main_index
Manticore 3.3.0 01fc8ad1@200204 release
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2020, Manticore Software LTD (http://manticoresearch.com)
using config file '/etc/manticoresearch/manticore.conf'...
indexing index 'cmn_main_index'...
collected 3 docs, 0.0 MB
creating lookup: 0.0 Kdocs, 100.0% done
creating histograms: 0.0 Kdocs, 100.0% done
sorted 0.0 Mhits, 100.0% done
FATAL: out of memory (unable to allocate 54525952 bytes)
Then I tried to lower mem_limit
to 32MB and I got:
indexer --sighup-each --rotate cmn_main_index deu_main_index eng_main_index fra_main_index gos_main_index heb_main_index jpn_main_index lez_main_index lfn_main_index oci_main_index ood_main_index spa_main_index vie_main_index
Manticore 3.3.0 01fc8ad1@200204 release
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2020, Manticore Software LTD (http://manticoresearch.com)
using config file '/etc/manticoresearch/manticore.conf'...
indexing index 'cmn_main_index'...
collected 3 docs, 0.0 MB
creating lookup: 0.0 Kdocs, 100.0% done
creating histograms: 0.0 Kdocs, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 3 docs, 168 bytes
total 0.300 sec, 559 bytes/sec, 9.98 docs/sec
rotating indices: successfully sent SIGHUP to searchd (pid=27285).
indexing index 'deu_main_index'...
collected 1 docs, 0.0 MB
creating lookup: 0.0 Kdocs, 100.0% done
creating histograms: 0.0 Kdocs, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 1 docs, 15 bytes
total 0.367 sec, 40 bytes/sec, 2.72 docs/sec
rotating indices: successfully sent SIGHUP to searchd (pid=27285).
indexing index 'eng_main_index'...
collected 11 docs, 0.0 MB
creating lookup: 0.0 Kdocs, 100.0% done
creating histograms: 0.0 Kdocs, 100.0% done
sorted 0.0 Mhits, 100.0% done
FATAL: out of memory (unable to allocate 27262976 bytes)
Eventually, I tried to index each index in a separate command and it worked:
for index in cmn_main_index deu_main_index eng_main_index fra_main_index \
gos_main_index heb_main_index jpn_main_index lez_main_index lfn_main_index \
oci_main_index ood_main_index spa_main_index vie_main_index; do
indexer --sighup-each --rotate "$index" || break
done
could you provide your config and source index data that reproduces this case?
Here you are: indexer_mem.zip.
Describe the environment
2.6.2:
Centos 6:
Packaged from source:
Describe the problem
mem_limit is set to 256M but the indexer process is using over 3GB of RAM
Steps to reproduce:
When indexing top shows the following
top
As you can see resident memory usage is 3.1G.
There are about 75k records in the table.
Messsages from log files:
No errors.