ANTS Memory Profiler - 7.3

ANTS Memory Profiler

Profiling SharePoint - ANTS Memory Profiler

ANTS Memory Profiler can profile managed code that runs on a Microsoft SharePoint 2007 or 2010 server.

To profile SharePoint:

  1. Start ANTS Memory Profiler. If it is already running, on the File menu, click New Profiling Session...
  2. On the ANTS Memory Profiler Settings dialog box, on the Application Settings tab, select SharePoint web application (IIS).
  3. To load a list of currently-running SharePoint sites into the dropdown list, click amp_refreshbutton .
  4. Choose the site that you want to profile.
  5. You should normally leave Profile child processes and Monitor disposal of objects selected, although monitoring the disposal of objects may affect the performance of your application.
  6. Select the port on which to profile your application:
    • If your application does not bind to a specific port, select Unused port and choose a port that is not used by IIS.
    • If your application must use the port on which it currently runs, select Original port (IIS will restart).

    If IIS does not restart correctly, use IIS Manager to stop the website until you have finished profiling.

    The port where the application will be profiled is displayed at the bottom of the ANTS Memory Profiler Settings dialog box.

  7. If required, select Manually specify ASP.NET account details and enter the User name, Password, and Domain.

    ANTS Memory Profiler profiles your web application as the Windows Local System user. If the Windows Local System user might not have appropriate permissions to use your SharePoint site collection, enter the credentials of a user with the required permissions. Note that the user you specify must also be an administrator on the computer on which ANTS Memory Profiler runs.

    With IIS 5, your web application will always run under the ASPNET account. Ensure that the ASPNET account has permission to read from %ProgramFiles%\Red Gate\ANTS Memory Profiler 7\RedGate.Memory.Core.dll

  8. The Profiling will use URL notice confirms the URL that will be used for profiling, including any unused port you have set.
  9. If required, change the performance counters to record.
  10. Click .
  11. Check whether there are any memory problems.

Troubleshooting SharePoint profiling

If you encounter difficulties, the most likely cause is that ANTS Memory Profiler cannot read from the directory to which SharePoint is writing data. To fix this:

  1. Create a temporary directory
  2. If you are not on a sensitive system, allow full read/write access to this temporary directory to all users. If you are on a sensitive system, ensuring that the local system account has read/write access should suffice.
  3. Use Control Panel to add a new environment variable. The variable must be called RGIISTEMP and the value is the path to the temporary directory you just created.

For more information, see Profiling SharePoint with ANTS Performance Profiler 5.2. (The information in this post is also valid for ANTS Memory Profiler 7.3.)

Known memory problems with SharePoint

SharePoint's API is still partly unmanaged; if you have been experiencing memory problems with SharePoint, you might find the following MSDN articles helpful:

Troubleshooting SharePoint profiling

Security features in ASP.NET may cause problems on some systems. In that case, follow the instructions below:

Information you will need

Before profiling a SharePoint 2007 site, you will need to know the following information for the site collection you want to profile:

  • the URL for the site collection
  • the TCP port it runs on
  • the name of the primary site collection administrator
  • the primary site collection administrator's password

To find the name of the primary site collection administrator:

  1. Open the SharePoint Central Administration website using the Start menu item.
  2. Click the Application Management tab.
  3. Under SharePoint Site Management, click Site Collection Administrators.
  4. From the dropdown list, select the name of the site collection hosting your web part.
  5. Note the account set in the Primary Site Collection Administrator box.

    amp_sharepoint_admin.gif

Grant permissions

The primary site collection administrator must have permission to launch an IIS 6 worker process. To grant this permission:

  1. Open Administrative Tools then open Local Security Policy.
  2. Under Local Policies, click User Rights Assignment.
  3. Double-click Act as part of the operating system and add the primary site collection administrator's account.

  4. Double-click Impersonate a client after authentication and add the primary site collection administrator's account.
  5. Open a command prompt and run
    gpupdate /force
    to enforce the new settings.
  6. Open Administrative Tools and go to Computer Management.
  7. Under Local Users and Groups, open Users.
  8. Double-click the primary site collection administrator's account and open the Member Of tab.
  9. Add the Administrators group.

MP_sharepoint_useradmin

The ANTS Memory Profiler 7.3 Service must use the primary site collection administrator's account when it starts. To configure this:

  1. Open Administrative Tools then open Services.
  2. Double-click the ANTS Memory Profiler 7.3 Service.
  3. Click the Log On tab.
  4. Select This Account and enter the primary site collection administrator's username and password.
  5. Click OK.
  6. If the status of ANTS Memory Profiler 7.3 Service is Started, right-click the service and click Restart.

Ensure that compilation will be in DEBUG configuration (IIS 6)

(Instructions for IIS 7 are below)

To profile a SharePoint collection, the ASP .NET compilation must be done in DEBUG configuration. This will allow ANTS Memory Profiler to locate the source code for any web parts or other extensions you have written for the site collection. DEBUG configuration also removes some unmanaged code restrictions that prevent profiling and stop the site from timing out.

To set DEBUG configuration, you must know the physical path to the root of the site collection website.

To find this path:

  1. Open Administrative Tools.
  2. Open Internet Information Server (IIS) Manager.
  3. Right-click the website containing the site collection then click Properties.
  4. Open the Home Directory tab.
  5. Note the path in the Local path box.

You must now locate and edit the web.config file for the site collection using notepad.exe (or other text-editor).

  1. Use Windows Explorer to navigate to the site collection root's physical path.
  2. Right-click the web.config file.
  3. Open the web.config file using a text editor. Search for the text 'Debug'.
  4. Change
    <compilation batch="false" debug="false">
    to
    <compilation batch="false" debug="true">.
  5. Save the file.

MP_debug_true.gif

Continue reading at the step 'Copy PDBs and web part DLLs to the app_bin directory' below.

Ensure that compilation will be in DEBUG configuration (IIS 7)

To set the application in DEBUG configuration in IIS 7:

  1. Load IIS Manager.
  2. Click the web application you want to profile.
  3. Click the .NET Compilation option.
  4. Under the Behavior group, set Debug to True.

Copy PDBs and web part DLLs to the app_bin directory

To filter out all methods except those run by your code when viewing the profiling results, you must copy the relevant files into the site's app_bin directory. To do this:

  1. Copy all PDB files and any web part DLLs used by your site to the Clipboard.
  2. Use Windows Explorer to navigate to the site collection root's physical path.
  3. Open the app_bin directory.
  4. Paste all PDB files and any web part DLLs used by your site into this directory.

Start profiling

  1. If the Internet Information Services Manager is not already displayed, open Administrative Tools and open Internet Information Server (IIS) Manager.
  2. Stop the website.
  3. Start ANTS Memory Profiler.
  4. Under Choose application type to profile, click ASP .NET Web Application (hosted in IIS).
  5. Enter the path to the ASP .NET web application that hosts your site collection. The path should be in the following format:
    http://server:port/
    The server is the name of the local server and the port is the TCP port that the web application normally runs on. If the site collection is on the root virtual directory for the site, you must include the trailing slash.
  6. To profile your application without restarting IIS select Unused port and enter a new port number. If your application uses hard-coded port numbers, your application will not work and you must chose Original port instead.
  7. Use your SharePoint 2007 Site Collection as normal. Any additions that you have coded, such as web parts and lists, will be reflected in the ANTS Memory Profiler results if these objects have been accessed.

amp_sharepoint_iis2

Was this article helpful?

Search support
Forums

ANTS Memory Profiler

all products