Sitecore performance and optimization (Part 1) : A Troubleshooting.



Here are few things I would like to mention to check the slow performing Sitecore site, and what can be done to fix it.

  1. Logs Reviews: 
    1. This is one of the wonderful features which is shipped with Sitecore, and we should make use of it to check the performance of the application, regularly checking the logs can help us in fixing the issue well before in time before it becomes critical.
    2. Logs can give us most of the details which include:
      1. Publishing details.
      2. Schedule task running.
      3. Any code error issue.
      4. Indexing or query issue.
      5. The issue with  MongoDB connectivity.
      6. The issue with SOLR server connectivity.
      7. The issue with SQL server connectivity
    3. Above are some of the details which we can review and proceed our the investigation, it’s always better to have something in hand to troubleshoot, instead of randomly looking for something.
  2. Enable JS,CSS Compression:
    1. This helps in boosting the performance of the application, by reducing page requests to the server or browsing the pages.
    2. We can make use of static and dynamic content compression in IIS.compression
  3. Sitecore Debugging:

    http://{YourWebsite}/?sc_mode=normal&sc_debug=1&sc_trace=1&sc_prof=1&sc_ri=1&sc_rb=1

    sc_mode – don't load the experience editor
    sc_debug - turn on the debug mode
    sc_trace - turn on Sitecore trace
    sc_prof - turn on Sitecore profiler
    sc_ri - show rendering information
    sc_rb - show rendering borders

    1. We should make use of the Sitecore debugger tool which can be found in Page editor, this gives a very good understanding and statistics around different components being used on the page.
    2. Helps in understanding which specific component(sublayout/rendering) takes how much time to render on the page.
    3. One of the early troubleshooting which every developer should start doing right from the time we start experiencing performance issues in the local development environment.
    4. These tools help in narrowing down the problem with code and thus helps in putting all our energy and time in right spot.sitecoredebugsitecoredebugprofile
  4. Sitecore Schedule tasks:
    1. Always try to review the Sitecore schedule tasks, and see if there is any task that is running and which is not expected?

    2. Make sure to review all the agents which are present under the <agents> section, in the web.config, or using a custom patch(if used).

    3. Another thing to note, we should also consider updating the frequency of that task execution by updating the time, if schedule task is not required we should disable it.

    4. See if the scheduled task is triggering site full publish, this can be a serious issue in the production environment, as this can clear all cache which can slow down the site.

    5. Keep a close watch on the logs for anything related to scheduled tasks.
  5. Indexing Strategy:
    1. Revisit the indexing strategy which is being used in the application, see if the full index rebuild is in place for any item publish event.

    2. Try to update the strategy if it’s not as per the requirement, or if it’s overkilling.

    3. Please review this document for anything related to available indexing strategy-

      https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/search_and_indexing/indexing/index_update_strategies

  6. Image optimization:
    1. I have seen this issue with several applications, just because the images are not properly optimized, they end up taking more resource bandwidth and resulting in a poor user experience.

    2. Remember, this is the time of mobile, and any poor-performing mobile site can be a serious issue to clients.

    3. We should always train and educate our client and content authors to make use of optimized images, and trust me they will listen to you.
  7. Indexes:
    1. This is one of the critical and important parts of any Sitecore application, try to use indexes as much as possible when it comes to fetching details from the repository or searching of the items based on specific condition and filters.

    2. Try to perform all the operations directly in the query like:
      1. Pagination.
      2. Sorting
      3. Filters

    3. Avoid fetching all the results and then applying business rules to filter it based on the specific conditions, as I mentioned trying to do most of the processing directly at the query level.

    4. I had seen issues in the application which was not performing well, just because of not making true use of indexes, review your index definition and configuration, and see if it has everything which is expected for it.

    5. Try to use create and use custom indexes for any custom feature, it’s always better to have one.

    6. The use of computed fields can be considered, this helps in executing any complex business logic while querying the results.
  8. Site publish:
    1. We should not trigger complete site publish in the production environment, unless and until it’s very much required, this can be a costly operation, as this clears all the cache.

    2. Try to publish only areas which are required, we can trigger full site published in the development environment but should be done carefully in production.

    3. Use Smart or Incremental Publish.
  9. Caching:
    1. Configure sublayout(s) and rendering(s) to use caching, this can give a real good browsing experience to site users.

    2. Clearing cache is something that should be considered in the production environment, when trying to publish items this will clear the cache and can slow down the application performance.
  10. GetDescendants:
    1. The use of GetDescendants is one of the costliest operations we can think off, we should always try using indexes or fast queries if possible and required.

    2. Revisit your code and search if there is any reference to GetDescendants, and update it if required.
  11. No of Items under one node:
    1. Try not to have more items under single-node/item, and break it down using several subfolders or items.

    2. This helps in giving good content editor experience.

    3. make use of item buckets wherever applicable.

Few important things to follow:

  1. Write good code.
  2. Proper unit testing.
  3. Get your code reviewed.
  4. Follow best practices.

This helps in fixing some of the issues before it goes to QA.

Please also refer to Sitecore recommendation for performance optimization: https://sdn.sitecore.net/Articles/Administration/Sitecore%20Performance/Optimizing%20Sitecore%206%20and%20later/Optimizing%20Performance%20in%20Sitecore.aspx

I hope this helps someone in troubleshooting Sitecore performance issues, please let me know if you have any questions or comments, happy to discuss.

Happy learning 🙂

Comments