Wednesday, November 12, 2008

SharePoint Performance Analysis Tool

This is a re-post from the Microsoft SharePoint Team Blog.  They’re releasing a tool in the next couple of weeks that allows you to do a very quick analysis of your SharePoint code’s performance. It focuses around disposing of SharePoint objects properly in your code, and “using (SPWeb web) …” coding techniques to ensure objects are released from memory when a code block exits. 

As soon as it drops I’ll make sure I post about it again and provide a download link.  In the meantime, this blog post directs us to a few best practices articles about how to properly manage memory for high-performance SharePoint code: 

 

The SPSite and SPWeb Dispose() methods are an important thing for developers who work with Microsoft SharePoint Products and Technologies to master. Many SharePoint API's allocate COM based memory that is not released by CLR garbage collection and must be released by calling the Dispose() methods. Microsoft Guidance for when to call SPSite and SPWeb Dispose() methods have been published in this MSDN whitepaper by Mike Ammerlaan and Scott Harris. In addition, Roger Lamb has provided additional detail and discussion on his MSDN SharePoint Developer blog. This guidance applies only to customers building custom software that they compiled to .NET assemblies that make use of SharePoint API calls.  Also, an update to the MSDN whitepaper is being planned to reflect key guidance from the blogs.

Microsoft wants to help developers build better quality code that manages available memory better. We are now building a console tool that will help to evaluate customer code against the guidance that is provided. The tool, calledSPDisposeCheck, will open your custom compiled assemblies recursively and validate them against the Microsoft published guidance. The output from the tool will contain messages that may indicate the SPSite and SPWeb Dispose() methods guidance is are not being followed in the customers source code. While these messages need expert evaluation in order to determine if the software is not performing properly, in some cases just running the tool on your custom code can lead you to simple fixes that improve the quality and performance of custom code on SharePoint. This tool is planned for release during the coming North American Winter.  Customers who are currently experiencing difficulties with memory management in their custom applications should review the guidance listed above.  Customers who are currently experiencing difficulties with Microsoft Office SharePoint Server 2007 should contact their regular Microsoft Customer Support Services contact, or refer to http://support.microsoft.com.

References:

Best Practices: Using Disposable Windows SharePoint Services Objects

Best Practices: Common Coding Issues When Using the SharePoint Object Model

SharePoint Tools for Visual Studio 2010

This is admittedly getting a bit ahead, but I ran across some information about tool support for SharePoint developers in the upcoming VS2010.  From what I had heard, there wasn’t much discussion at PDC.  At a more recent conference though they shed some light on what sounds like a great toolset for SharePoint developers in the upcoming release of Visual Studio: 

  • Server Explorer for SharePoint viewing Lists and other artifacts in SharePoint directly inside of Visual Studio

  • Windows SharePoint Services Project (WSP file) Import to create a new solution

  • Added a new web part project item and showed the Visual web part designer which loads a user control as a web part for SharePoint

  • Showed adding an event receiver for SharePoint and using the wizard to choose the event receiver and to just create a source file with that event receiver.

  • Added an ASPX workflow initiation form to a workflow project and showed how this workflow initiation form has designer capability

  • Showed the packaging explorer and the packaging editor which lets you structure the SharePoint features and WSP file that is created

More on http://channel9.msdn.com/tags/Visual+Studio+2010/