Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use visual studio performance profiling with service fabric?

Hopefully this is simple...

I want to performance profile my service fabric cluster.

So far I: - Go to Start Diagnostics tools without debugging. - Go through the wizard selecting my service fabric project as the startup project. - Then it asks which projects to include, so I include my service exe - Then I select instrumentation (I want method level timing)

Then I hit start and immediately my exe crashes. I assume this is because visual studio is trying to run my "service" outside of the service fabric context as a standalone exe.

Not sure what to do about that though...

The stack trace is:

DEBUG: Activating options

Unhandled Exception: System.Fabric.FabricConnectionDeniedException: Not authorized to connect ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071C43 at System.Fabric.Interop.NativeRuntime.FabricEndGetNodeContext(IFabricAsyncOperationContext context) at System.Fabric.FabricRuntime.NativeFabricRuntimeFactory.GetNodeContextEndWrapper(IFabricAsyncOperationContext context) at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously) --- End of inner exception stack trace --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.RuntimeContext.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Runtime.ServiceRuntime.d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Thanks for the help in advance!

like image 765
Steve Avatar asked Jun 08 '16 14:06

Steve


People also ask

How do I run a performance profiler in Visual Studio?

Open the Performance Profiler by choosing Debug > Performance Profiler (or Alt + F2). For more information on using the CPU Usage or Memory usage tool in the Performance Profiler vs. the debugger-integrated tools, see Run profiling tools with or without the debugger.

How do I run a fabric application locally Visual Studio?

In Visual Studio, pressing F5 deploys your application and attach the debugger to all application instances. You can use Ctrl+F5 to deploy an application without debugging, or you can publish to a local or remote cluster by using the publish profile.

How do I use the diagnostic tool in Visual Studio?

When you start debugging in Visual Studio by selecting Debug > Start Debugging, or pressing F5, the Diagnostic Tools window appears by default. To open it manually, select Debug > Windows > Show Diagnostic Tools. The Diagnostic Tools window shows information about events, process memory, and CPU usage.


1 Answers

What you're seeing is Visual Studio attempting to start your service host process on its own outside of the Service Fabric runtime. Normally, when you run a service through Visual Studio, you deploy the application project, which goes through the process of registering and instantiating your services on your local Service Fabric cluster.

Instrumentation currently doesn't work out-of-the-box with Service Fabric projects for this reason. We're looking at ways to make this possible in the future.

You can still do Sampling profiling, which allows you to attach the profiler to a running EXE. In that case, you'd deploy your application normally first, then attach the profiler to your service EXEs.

like image 109
Vaclav Turecek Avatar answered Oct 22 '22 08:10

Vaclav Turecek