⚠️ Эта страница автоматически переведена, и перевод может быть несовершенным.

Sphinx 3 vs Manticore: performance benchmark

[UPDATE] Более свежий бенчмарк доступен здесь .

Недавно долгожданный Sphinx 3 был выпущен и обновлён до версии 3.0.2 . Он получил возможности хранения документов, A‑индексы, предварительное индексирование сниппетов и, к сожалению, больше не является открытым исходным кодом (по крайней мере сейчас, в марте 2018 года).

Все эти функции очень приятны, но вам интересно, насколько они повлияли на производительность Sphinx 3 и насколько это отличается от производительности Manticore? Нам тоже!

Чтобы выяснить это, мы создали бенчмарк для измерения:

  • времени индексации
  • максимальной пропускной способности, которую могут дать Sphinx 3 и Manticore Search 2.6.2
  • минимальной задержки, которую оба могут обеспечить

Бенчмарк основан на следующем:

  • luceneutil для генерации данных для индексации и наборов запросов
  • lucene2manticore для преобразования данных из формата Lucene в формат Manticore Search / Sphinx
  • stress-tester для тестирования
  • сервер: 8xIntel(R) Xeon(R) CPU E3-1275 v5 @ 3.60GHz, 64G RAM, HDD
  • ОС: Ubuntu 16.04.3 LTS, ядро 4.8.0-45-generic

Here are the results:

ms_vs_s3_indexation

ms_vs_s3_throughputms_vs_s3_latencyКак видно во всех протестированных сценариях Sphinx 3 имеет гораздо более длительное время индексации и гораздо худшую производительность: как пропускную способность, так и задержку. Мы считаем, что это может быть вызвано проблемой компиляции (опять же, Sphinx 3 не является открытым исходным кодом, поэтому мы не можем перекомпилировать) или общей утечкой производительности, которую можно было бы отладить и исправить, если бы исходный код был доступен. Было бы печально, если новые функции ухудшают производительность настолько. Но в любом случае мы хотим предупредить всех пользователей Manticore и Sphinx, что при переходе на Sphinx 3 вы можете столкнуться с деградацией производительности.

Please let us know if you have different results of migration to Sphinx 3 or comparison between Manticore and Sphinx 3, it would be great to figure out in what cases the performance does not degrade.

Ping us if you need our help.


Here's how you can reproduce the benchmark

Be aware that downloading and preparing the data may take few hours.

  1. Install the above supplementary tools and prepare the configs and stopwords files:
mkdir data
mkdir q

git clone http://github.com/mikemccand/luceneutil.git
git clone http://github.com/manticoresoftware/lucene2manticore
git clone http://github.com/Ivinco/stress-tester

cp lucene2manticore/*.conf ./
  1. Install Manticore Search and Sphinx3 binaries.
  2. Fetch and prepare the source data
cd luceneutil
python src/python/setup.py -download
cd ../data/
xzcat enwiki-20120502-lines-1k.txt.lzma > lucene.tsv

convert the data from Lucene TSV-like format to proper TSV format that can be used with Manticore Search and Sphinx data sources:

cd ..
python lucene2manticore/lucene2tsv.py data/lucene.tsv --maxlen 2097152 > data/lc.tsv
head -n 100000 data/lc.tsv >  data/lc100k.tsv
head -n 300000 data/lc.tsv > data/lc300k.tsv
head -n 1000000 data/lc.tsv > data/lc1m.tsv
  1. Prepare the queries
python lucene2manticore/lucene2query.py --types simple data/wikimedium500.tasks > q/q-wiki500-simple.txt
python lucene2manticore/lucene2query.py --types ext2 data/wikimedium500.tasks > q/q-wiki500-ext2.txt
python lucene2manticore/lucene2query.py --types simple luceneutil/tasks/wikimedium.10M.datefacets.nostopwords.tasks > q/q-wiki10m-simple.txt
python lucene2manticore/lucene2query.py --types ext2 luceneutil/tasks/wikimedium.10M.datefacets.nostopwords.tasks > q/q-wiki10m-ext2.txt
python lucene2manticore/lucene2query.py --types simple luceneutil/tasks/wikimedium.1M.nostopwords.tasks > q/q-wiki1m-simple.txt
python lucene2manticore/lucene2query.py --types ext2 luceneutil/tasks/wikimedium.1M.nostopwords.tasks > q/q-wiki1m-ext2.txt
cat q/q-wiki*-simple.txt > q/q-simple.txt
cat q/q-wiki*-ext2.txt > q/q-ext2.txt
  1. Prepare stop words
indexer -c lucene2manticore/sphinx3.conf i2_1m_no_stopwords --buildstops stopwords1k.txt 1000
head -100 stopwords1k.txt > stopwords.txt
  1. Index the data and remember how much it takes:
./indexer -c lucene2manticore/manticore.conf --all
./indexer -c lucene2manticore/sphinx3.conf --all
  1. start search daemons
/path/to/manticore/searchd -c lucene2manticore/manticore.conf
/path/to/sphinx3/searchd -c lucene2manticore/sphinx3.conf
  1. warm up the servers

It's worth to warm up the search daemon before testing, e.g. like this:

cd stress-tester
for q in simple ext2; do for p in 8306 7406; do ./test.php --plugin=plain.php --data=../q/q-$q.txt -b=100 -c=8 --port=$p --index=i2_100k_stopwords_100 --maxmatches=100 --csv; done; done;

Throughput test cases

We now know how much indexation takes (see p. 4 above). Let's see how much throughput Sphinx 3 and Manticore Search can give.

Simple queries against 100K docs index with top 100 stop words:

for port in 7406 8306; do for c in 1 4 6 8 12; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_100k_stopwords_100 --maxmatches=1000 --csv; done; done; done

Simple queries against 100K docs index with top 1000 stop words:

for port in 7406 8306; do for c in 1 4 6 8 12; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_100k_stopwords_1k --maxmatches=1000 --csv; done; done; done

Complex queries against 100K docs index with top 100 stop words:

for port in 7406 8306; do for c in 1 4 6 8 12; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-ext2.txt -b=$batchSize -c=$c --port=$port --index=i2_100k_stopwords_100 --maxmatches=1000 --csv; done; done; done

Complex queries against 100K docs index with top 1000 stop words:

for port in 7406 8306; do for c in 1 4 6 8 12; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-ext2.txt -b=$batchSize -c=$c --port=$port --index=i2_100k_stopwords_1k --maxmatches=1000 --csv; done; done; done

Simple queries against 100K docs index with top 100 stop words and morphology enabled:

for port in 7406 8306; do for c in 1 8; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_100k_stopwords_100_morphology --maxmatches=1000 --csv; done; done; done

Simple queries against 1M docs index with top 100 stop words:

for port in 7406 8306; do for c in 1 8; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_1m_stopwords_100 --maxmatches=1000 --csv; done; done; done

Complex queries against 1M docs index with top 100 stop words:

for port in 7406 8306; do for c in 1 8; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-ext2.txt -b=$batchSize -c=$c --port=$port --index=i2_1m_stopwords_100 --maxmatches=1000 --csv; done; done; done

Simple queries against 1M docs index with top 100 stop words and morphology enabled:

for port in 7406 8306; do for c in 1 8; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_1m_stopwords_100_morphology --maxmatches=1000 --csv; done; done; done

Simple queries against 1M docs index with top 100 stop words filtering by attributes to skip half of the documents:

for port in 7406 8306; do for c in 1 8; do for batchSize in 1 100; do ./test.php --plugin=plain.php --data=../q/q-simple.txt -b=$batchSize -c=$c --port=$port --index=i2_1m_stopwords_100 --maxmatches=1000 --filter='ts<1199141654' --csv; done; done; done

Установить Manticore Search

Установить Manticore Search