One way to troubleshoot performance issues with a Sitecore page

I bet most of you already do this, but, I’ll mention it anyway.  I was having a lot of issues with one of the sites I was building.  Turns out it was an endless loop in my code.  In a project with thousands of lines of code, I was able to find the issue and resolve it quickly.  So, how did I find the issue, you may ask.

  1. Moved the site to another server and changed the URL
    1. This was done so no one would be hitting the site while I was trying to find the problematic page.
  2. I then started clicking through the site and watching the Task Manager on the server.
    1. One page finally caused the CPU to spike.
  3. I killed the process a few times and tried that same page again.  Every time it spiked the CPU.
    1. I then went to the Sitecore Item for this page and looked at the Presentation Details.
  4. I started removing Sublayouts, one at a time, and testing the page again.
  5. Eventually one of the Sublayouts I removed allowed me to go to the page and the CPU no longer spiked.
  6. I added the Sublayout back in, tried the page, and the CPU spiked again.  So I knew the problem was in this Sublayout.
  7. I went into the code for this Sublayout and found an endless loop.  That was the culprit!

These were the steps I took to debug my issue.  A few things were key here:

  1. Moving the site to a different server.
    1. This was really helpful because it allowed me to stop the site and start it again and see exactly what was spiking the CPU.
    2. When the site was on the URL that the client had access to, I could never stop the process because there was always someone with a browser open requesting a page on the site.
  2. Removing Sublayouts one at a time allowed me to identify where the problem was coming from.

I hope this is helpful for you!

Leave a Reply