Searchkick: Add option to reindex with multiple threads

Created on 29 Nov 2016  路  5Comments  路  Source: ankane/searchkick

Use multiple threads to send data to Elasticsearch to speed up reindex for larger clusters.

Product.reindex(concurrency: 4)

https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html#_use_multiple_workers_threads_to_send_data_to_elasticsearch

enhancement help wanted

Most helpful comment

^ Done. Check out https://github.com/ankane/searchkick#large-data-sets

All 5 comments

I added this in the threads branch. However, in the benchmarks on my machine, it's not faster. Still trying to identify the bottleneck, but happy if others want to help.

git clone https://github.com/ankane/searchkick.git
cd searchkick
git checkout threads
BUNDLE_GEMFILE=benchmark/Gemfile bundle
BUNDLE_GEMFILE=benchmark/Gemfile bundle exec rake benchmark

Think it has to do with thread scheduling. New direction: will try to do parallel requests with Faraday + Typhoeus.

In performance benchmarks, Ruby code to query the DB and generate search data is the biggest bottleneck. Using ActiveJob to parallelize this across multiple processes / machines (not just threads) is best, but requires some orchestration.

^ Done. Check out https://github.com/ankane/searchkick#large-data-sets

That link is now https://github.com/ankane/searchkick#parallel-reindexing

Was this page helpful?
0 / 5 - 0 ratings

Related issues

netwire88 picture netwire88  路  3Comments

namila picture namila  路  4Comments

mehulkar picture mehulkar  路  5Comments

justi picture justi  路  3Comments

gerrywastaken picture gerrywastaken  路  3Comments