Yesterday we had a serious issue with one of the improved layout for a release 2 of one of our projects. As it really became a show stopper for 2 of my colleagues I decided to give it the highest priority. While debugging I came to the conclusion I wasn’t really following a straight path. Just ‘doing something’. So 10 minutes ago I wrote down the most of the steps taken and I want to share them with you. So you can debug your apps in a way better way.
Usefull requirements for debugging:
- Always try to have a read-only acocunt to the production environment. I know it’s from a security point of view not always a good choice, but when it remains read-only, it won’t harm your production environment ever.
- Make sure you’ve got a quite clean machine. A SQL Server 2005 with CLR Support will make your results less obvious. Same goes out to BizTalk, multiple webservers, etc. So try to isolate your problem.
Steps to take:
- Identify where the issue is
- Walk trough your logfiles. Are there any warning such as:
2572 10:43:30 WARN Timing threshold exceeded for web page. Milliseconds: 30436,72. Threshold: 1000. Page URL: /Sitemap.aspx
2572 10:43:30 WARN Item threshold exceeded for web page. Items accessed: 8940. Threshold: 1000. Page URL: /Sitemap.aspx - Run the Sitecore debugger and tracer
- Enable and disable sublayouts and renderings
- In some cases you’ve to select another Layout/Masterpage
- When you can’t find anything, just attach Visual Studio to your ASP.NET-process, reload the page and wait for exceptions/overflows. When this doesn’t help, use the debugger-pause button and manually step trough your code.
- Walk trough your logfiles. Are there any warning such as:
- So now you’ve identiefied where the issue is you general got 2 options, XSLT or code. For both I’ve some hints as well:
- XSLT
- Find out if you aren’t running trough to many levels of items.
- Try to minimize your amount of data used.
- XPath, Axes and predicates are extremely heavy get rid of them!
- Make sure you made the right choice when using developing this functionality.
- Are you using caching? Is this functionality cachable?
- Code
- Using Sitecore Query? Read this post by Sitecore’s Kim Hornung on Query performence.
- Are there any haevy operation such as connections/regexp/data convert(e.g. XmlDoc construction)
- Is your code accessed once or more often? Aren’t you databinding twice per pageview for example?
- Use SectionTimers to divide your page in clear pieces.
- XSLT
Happy debugging!
