views:

163

answers:

2

I just wonder what options there are to properly measure/profile/optimize ASP.net 2.0 Web Parts, especially the ones for Sharepoint 2007?

As Web Parts are a layer on another layer of technology, getting resource usage, open handles and stuff only for the web part seems to be a bit difficult.

Does anyone know some good tools or practices for profiling and optimizing web parts?

A: 

I have found seperating out all the business logic in to a seperate DLL that is easily unit testable has been the easiest method for me. But to be honest there is really no good way that I have found, besides what I have just mentioned. The same has been true for me with Facebook applications recently. I think this is common for any application that runs inside of another platform. Especially when performance and testing where never a goal when the platform developers started to build the system.

Nick Berardi
A: 

Back when we started with SP2003, we used to worry about not closing connection in apps or web parts. We used the following query to check if the base number of connections (not counting the initial spike) would increase as the app is used on the development server:

SELECT hostname, sysdatabases.name , sysprocesses.status, lastbatch from sysprocesses, sysdatabases where sysprocesses.dbid = sysdatabases.dbid and ntusername = 'SP Service Account' and (hostname='WFE1' or hostname='WFE2') and sysprocesses.dbid = 10 order by last_batch desc

(replace the bolded values with those appropriate for your environment)

We haven't tried this since the upgrade to MOSS though.

Eugene Katz