Book Image

Apache Solr High Performance

By : Surendra Mohan
Book Image

Apache Solr High Performance

By: Surendra Mohan

Overview of this book

Table of Contents (14 chapters)

Reducing the file count in the index


Consider a situation where you have a Solr instance running for a long duration and the index is split into multiple files (which is quite natural and expected). Did you imagine how time-consuming it is for Solr to keep connecting all the files of an index to fetch the desired result set, resulting in a performance drop? Don't get hassled; we can figure this out and we will learn how to overcome the issue in this section.

Since the root cause behind this performance drop is the segment's file count (which is huge) that is associated to an index, the solution we can think of is to find a way to merge these split off segment files into one. To do so, we run the optimize command as follows:

curl 'http://localhost:8983/solr/update' --data-binary '<optimize/>' -H 'Content-type:text/xml; charset=utf-8'

After a couple of minutes or probably hours (this primarily depends on the index size), you will get the following response:

<?xml version="1.0" encoding...