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

<p>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.</p>

<p>Does anyone know some good tools or practices for profiling and optimizing web parts?</p>

[{'answer_id': 19827, 'author': 'Nick Berardi', 'author_id': 17, 'author_profile': 'https://Stackoverflow.com/users/17', 'pm_score': 0, 'selected': False, 'text': '<p>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.</p>\n'}, {'answer_id': 19874, 'author': 'Eugene Katz', 'author_id': 1533, 'author_profile': 'https://Stackoverflow.com/users/1533', 'pm_score': 1, 'selected': True, 'text': "<p>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:</p>\n\n<p>SELECT hostname, sysdatabases.name , sysprocesses.status, last_batch from  sysprocesses, sysdatabases where sysprocesses.dbid = sysdatabases.dbid and nt_username = '<strong>SP Service Account</strong>' and (hostname='<strong>WFE1</strong>' or hostname='<strong>WFE2</strong>') and sysprocesses.dbid = <strong>10</strong> order by last_batch desc</p>\n\n<p>(replace the bolded values with those appropriate for your environment)</p>\n\n<p>We haven't tried this since the upgrade to MOSS though.</p>\n"}, {'answer_id': 7156761, 'author': 'Chris Coulson', 'author_id': 719398, 'author_profile': 'https://Stackoverflow.com/users/719398', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve had success profiling SharePoint 2010 with <a href="http://www.eqatec.com/Profiler/Home.aspx" rel="nofollow">EQATEC Profiler</a>. Bonus is that they have a free edition. Since it worked in SharePoint 2010, I expect it will work with SharePoint 2007.</p>\n\n<p>Here\'s how I got it working with SharePoint 2010: <a href="http://blogs.visigo.com/chriscoulson/performance-profiling-a-sharepoint-2010-project-using-eqatec-profiler/" rel="nofollow">http://blogs.visigo.com/chriscoulson/performance-profiling-a-sharepoint-2010-project-using-eqatec-profiler/</a></p>\n'}]
['https://Stackoverflow.com/questions/19803', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/91/']