Remote Profiling with dotTrace Performance

You’ve got a thorny performance problem, but it only happens in your staging and production environments. For some reason, you just can’t seem to reproduce it on your local machine. What’s a developer to do? Fortunately dotTrace can profile a remote application and with dotTrace 5.2, it’s easier than ever before. Let’s walk through the steps of collecting a performance snapshot from a remote machine.

Step 1: Copy the dotTrace Remote Agent to the remote server

First we need some way for dotTrace to connect to the remote machine. This is done using the dotTrace Remote Agent, which ships with dotTrace. It can be found in:

C:Program Files (x86)JetBrainsdotTracev5.2BinRemote

dotTrace Remote Agent directory

The contents of this directory are XCopy deployable. The target machine requires .NET 2.0 or greater installed. Simply copy the “.BinRemote” directory to the remote server using RDP, file share, or any other file copy method of your choice.

Step 2: Run the dotTrace Remote Agent on the remote server

Log into the remote server and run RemoteAgent.exe. To profile an application running as a different user (e.g. ASP.NET web app running under IIS), shift-right-click RemoteAgent.exe and select “Run as administrator”. A console window similar to the one below will appear:

dotTrace Remote Agent running

By default, the Remote Agent will listen on all network interfaces and both IPv4 and IPv6 protocols. Network traffic happens over HTTP and it defaults to port 9000. You can configure a variety of options if you need to change the defaults. Run `RemoteAgent.exe /?` for a full list of options. You will need to configure your firewall to allow TCP traffic on port 9000 (or whichever port you configured with the /port=VALUE option).

Step 3: Attach to the dotTrace Remote Agent from dotTrace on your local machine

Once the Remote Agent is running on the remote computer, you can connect to it from dotTrace running on your local machine using the “Attach To Process” button in dotTrace.

Attach to Process

If you haven’t remotely profiled an application before, click on the “Profile on remote computer” link to bring up the Add Host dialog. If you have remotely profiled an application before, but not on this remote server, click the Add… button and enter the Remote Agent URL for that remote computer.

Profile App

Add Host

The Remote Agent URL will look like http://URL:PORT/RemoteAgent/AgentService.asmx. If you have connected to the remote computer before, it will be available in the drop down list.

Step 4: Profile the application

After the remote computer is selected, a list of .NET 4.0 and above processes will be displayed. Due to limitations of the .NET Profiler API, it is only possible to attach to processes running .NET 4.0 and above.

Profile App with Connection to Remote Server

Choose whether you want to start profiling immediately or whether you would like to start with profiling disabled and click “Run”. The usual dotTrace profiling control dialog will appear. The only difference is that the performance data is being acquired on the remote computer.

dotTrace profiling control dialog

Step 5: Get Snapshot and Analyze

Exercise the remote application in a way that demonstrates the performance problem and click “Get Snapshot”. The performance snapshot will automatically be downloaded to dotTrace and opened – ready for analysis.

Analyze snapshot

You can analyze the snapshot data just as if you had recorded the snapshot locally. After determining the root cause and deploying a fix, you can repeat the process to collect another snapshot and verify that you have resolved the performance problem.

Profile with pleasure!

image description