Solr with Sitecore Checklist



We have been using Solr with Sitecore for our latest Sitecore implementations as it offers better index synchronization across all CD/CM servers since its a standalone web app with HTTP access, which means that all CD/CM servers will have up-to-date indexed content, unlike lucene where each Sitecore server is responsible of synchronizing its lucene index, which sometimes breaks and causes content to be out-dated.

This blog is not about how to configure Solr with Sitecore, there are many blogs talking on this subject, This blog is about some considerations and best practices that you need to take into account when you setup Solr with Sitecore.


    First, Disable Indexing on CD's

With Solr/Sitecore setup, you only need to enable indexing on CM, and disable it on CD servers, By default after any publish operation, Sitecore will store (item changed/added) event into Event Queue table, and each Sitecore instance will pick that and trigger index job for that item, With Solr we only need CM to trigger index job.

To disable indexing on CD, you need to change the indexing strategy for each index to be "Manual", like :

 <strategies hint="list:AddStrategy">
              <strategy ref="contentSearch/indexConfigurations/indexUpdateStrategies/manual" />
  </strategies>


   Second,  Allocated Memery

We were using bitnami Apache Solr, and by default it is configured to use 256MB for the memory heap, This is not enough for Sitecore production environment, As you will start to see errors like "OutOfMemory", I usually set the initial allocated memory to 1GB, and maximum to 8GB, you can change this based on the size of your content, To configure Bitnami Solr allocated memory you need to do the following:
  1. Open /Bitnami/solr-VERSION/apache-solr/scripts/serviceinstall.bat file, and edit (or add if does not exists) the following java options:
    ++JvmOptions=-Xms1024M 
    ++JvmOptions=-Xmx8192M 
  2. Make sure SOLR is running on JAVA 64-bit runtime, By default, Bitnami SOLR will install 32-bit java version and use that if Java is not installed, which will limit the maximum Memory size that Solr can use, Download JAVA 64-bit version and install it, then in 'serviceinstall.bat' file, you need to change :
    --JavaHome="C:\Bitnami\solr-4.9.0-0\java"
    TO

    --JavaHome="C:\Program Files\Java\jre7"
    Or to whatever your java installation folder is.
  3. Now you need to re-install Solr service, Open command prompt (Administration mode) and run the following commands:
    cd
      C:/Bitnami/solr-VERSION/apache-solr/scripts

    serviceinstall.bat REMOVE
    serviceinstall.bat INSTALL
Now, open Solr admin page and you can check at the bottom that all of above settings were applied.



     Third, Solr Cores

With sitecore, you can use one Solr core for all of your content indexes (web, master, core), however i would advise you to use separate core for each one, this will prevent having 1 big core which keeps growing fast , instead you will have smaller cores, which improve your Indexing/Search operations, Create three separate Cores in Solr, and update Solr Index configurations, so that each index points to it's own Core.

Also, In production environment, you need to enable "Switch On Rebuild" in sitecore , so that while you rebuild your indexes, Sitecore will switch any search operation to run on a back-up core until the indexing is finished, This will keep your front end pages that uses search running without any errors.

To do this,Create a new core in Solr , name it "itembuckets_sec" for example, Then you need to change your index "type" attribute and add a new param "rebuildccore" in solr indexes configuration (usually we do this for web index) as following:

<index  id="sitecore_web_index" type="Sitecore.ContentSearch.SolrProvider.SwitchOnRebuildSolrSearchIndex, Sitecore.ContentSearch.SolrProvider">
     <param desc="name">$(id)</param>
     <param desc="core">itembuckets</param>
     <param desc="rebuildcore">itembuckets_sec</param>
     ....
     ....
     ....
</index>


     Fourth, Common error

Almost on every production environment we had, we were seeing this error in Solr:
Error opening new searcher. Exceeded limit of maxWarmingSearchers=2, try again later.
It appears that sitecore indexing perform lots of commits to solr concurrently, causing this error when the searchers that are warming in the background exceed 2 (the default value is 2), We usually increase that to solve the issue.
You will need to go to : "Bitnami\solr-[VERSION]\apache-solr\solr\[CORE NAME]\conf\solrconfig.xml" file and change the value in"maxWarmingSearchers" to higher value.



Have something else to add to this checklist? share it in the comments!


Comments

  1. educational franchise in india

    Education franchises may be after school supplemental learning and tutoring services, or they may be daycare businesses that operate regularly for younger .

    ReplyDelete
  2. top 10 overseas education consultancy in india


    Studying abroad gives an edge to the global viewpoint, career & personality of a student. Choosing the best Overseas Education Consultants in India

    ReplyDelete
  3. Good blog, it's really very informative, Thanks for sharing. Are you looking to enhance your English language skills from the comfort of your home? Ziyyara Edutech’s online English tuition classes are designed to provide personalized and effective learning opportunities for students of all levels.
    For more info visit Online english tuition

    ReplyDelete
  4. I am glad to discover this post Very valuable for me. Join our Online speaking English language class in Bahrain and embark on a journey towards fluency, confidence, and success.
    Book a free demo today. Best english tutoring in bahrain

    ReplyDelete

Post a Comment

Popular posts from this blog

Attaching a file on WFFM Send email action

Set Workflow using Item Buckets Search Operations