#Protip: SOLR throws java.lang.OutOfMemoryError when re-indexing Sitecore Indexes

As you may know, Sitecore 9 has it’s default search engine configured with SOLR, instead of Lucene. This requires you to install SOLR, in order for Sitecore 9 to work. There are some really informative, thorough posts on how to accomplish this, so I won’t go into that.

What I wanted to focus on is when you setup the SOLR to run as a windows service. The default command of running the SOLR command:

solr.cmd -f -p 8983

…sets the default memory allocation for the SOLR heap, which is 512MB. This is because we don’t actually set a parameter for the heap size. Depending on the content you have in your Sitecoreinstance, you may get java.lang.OutOfMemoryError errors when re-indexing. To fix this, you need to explicitly specify the heap size, which you set as such:

solr.cmd -f -p 8983 -m 1024m

This sets it to 1GB. You can adjust as needed – how much you need will depend on your situation – this article has some pointers on how to decide the size. This should allow you to re-index your large Sitecore indexes.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s