On 3/12/2015 3:36 PM, Alexandre Rafalovitch wrote:
Manual optimize is no longer needed for modern Solr. It does great
optimization automatically. The only reason I recommended it here is
to make sure that all segments are brought up to the latest version
and the deleted documents are purged. That's something that also would
happen automatically eventually, but "eventually" was not an option
for you.
I am glad this helped. I am not 100% sure if you have to do it on each
shard in SolrCloud mode, but I suspect so.
In SolrCloud, whenever you send an optimize command to any shard replica
in a collection, the entire collection will be optimized. SolrCloud
will do the optimization sequentially, not in parallel. There is
currently no way to optimize only one shard replica, and as far as I
know, there is no way to ask for a parallel optimization.
Alexandre's comments about the necessity of optimization (whether it's
SolrCloud or not) is spot on. The only time that optimization should be
done on a modern Solr index is when you have a lot of deleted documents
and want to clean those up, either to reclaim disk space or remove them
from the relevancy calculation.
Most people do see a performance boost on an optimized index compared to
a non-optimized index, but with a modern Solr install, you might
actually see better performance on a multi-segment index when the
indexing rate is high, because Lucene is moving to a model where there
are per-segment caches that are not invalidated at commit time, only at
merge time.
Thanks,
Shawn