Is there any way to profile performance of a WCF Application? - c#

We're trying to measure performance of our system, which is a .NET 3.5 application that uses WCF calls.
Problem is until now, we weren't able to profile the methods inside these calls. A winforms client application was coded to test our system. We tried using ANTS 4 Profiler and VS2008 built-in Performance Analyzer, but we only got the total time of the WCF call. We would like to be able to measure all the calls that are being made inside of the WCF call.
Does anybody know if that's possible?
Thanks in advance.

There is quite a bit of performance testing functionality built into Visual Studio Team System Test Edition.
Take a look on this page and scroll down to the section Introduction to Load Tests.
Also this WCF Load Test application on codeplex might be helpful

So your application can run under VS, but WCF calls off to an environment where you cannot get profiling visibility, but you want to know what goes on in there?
Even if you find out how WCF uses time inside itself, any changes you make will have to be in your code. If you want to find out where in your code you can do something about performance, you can use the VS profiler. Personally, I just use stackshots, which are very effective at finding out what code to optimize under any environment, including C#.

Related

How to measure the execution time of all methods in .NET Core?

I need to debug the performance of a slow application that sometimes gets slow and sometimes works just fine.
It's really hard and I can't find what's the problem.
I thought about IL weaving and tools like PostSharp. But since I only want a very specific requirement, I thought maybe there are other ways/techniques that I'm not familiar with.
My need is to log the overall execution time of each and every method. How can I get that? Is IL weaving the only option?
You do that with a profiler, e.g. dotTrace for C#. If you have Resharper Ultimate, dotTrace is included.
.NET profilers do not only measure the time of all your methods, but also the time in .NET garbage collection.
There's also a profiler available in newer versions of Visual Studio.
Although it could be done with IL weaving as well, you would not compile an extra version just for this purpose. With a profiler, you can change the settings without recompiling your code every time.
The profiling tools mentioned in other answers allow you to analyze the application performance in a controlled environment on your development machine. This can help you to find which sections of code need optimization.
However, you may also want to monitor the application performance in the production environment. This can help you to find out which other factors external to your code and specific to the environment are affecting the performance.
For the second use case you can check out PostSharp Diagnostics Framework (http://doc.postsharp.net/logging). It allows you to include detailed logging into your application including method execution time and is highly configurable. The logging can be turned on and off in the configuration, so there's no need to create two separate application builds.
Another option to look into is an Application Performance Monitoring tool installed in the production environment. A quick search will give you examples such New Relic APM, DynaTrace, AppDynamics and others.
In the end, it's up to you to make a choice of specific tool based on your use case and budget.

Simulate load and analyze for a .net web service and SQL server

Here is my scenario, I developed an android application that periodically makes calls to a web service, which in turn performs queries against a database. In the field there will be hundreds of these devices running constantly polling roughly every 60 seconds. There are some concerns about efficiency due to the volume and frequency of use and I have been told to find any potential performance issues and come up with strategies to combat them. (All I've seen is issues with heavily fragmented indexes)
So my questions to you are:
What are some ways of simulating load on a web service?
With SQL - I am familiar with examining execution plans, is there anything beyond that I should be concerned with?
How do I measure the 'efficiency' of a .net web service? What kinds of things should I be on the lookout for? Is there a tool I can use to see hot spots and potential bottlenecks?
I appreciate any resources and insight you can provide, thanks!
If you have access to an MSDN Ultimate license you can use the load test projects that are built into Visual Studio. Using their load tests you can run whatever load test you engineer and it records performance data so you can see the impact during the test.
http://www.microsoft.com/visualstudio/eng/products/compare
In the Feature Comparison > Testing Tools section they have a video covering load testing.
If your web service is running over HTTP (which is likely), than most web load testing software has the capability to do what you need. A few of them can even record traffic from a local Android device, which you can then customize to generated the load you need.
I'll suggest our own product, Load Tester LITE, which may be able to do everything you need for free. The recording ability depends on the specific version of Android you have available - our support guys will be happy to help you work through it.

Lightweight profiling for Silverlight?

I would like to profile certain actions in my application in a production environment.
I have previously used Stopwatch in .NET
It does not seem to exist in Silverlight (despite being in the documentation).
Can anyone suggest some alternatives? Is there anything better than DateTime.UtcNow?
I have used Yourkit and use ANTs in development, but I would like to gather information about performance of deployed software. I do not have access to the kind of data the users have, but can gather some logging.
Is this post any use at all?
It sounds like you want to deploy profiling IN your application so you can see how it performs on the user's PC?
Firstly you could have a look at this answer. Standard timers (eg looking at the value of DateTime.Now) are only going to give you rough resolution, which seems to be around 16ms at best.
Otherwise you can grab a performance profiling tool, there are several now which work out of the box with Silverlight, are easy enough to use and don't really take that long to get started with, with free evaluations. Two such tools JetBrains dotTrace and RedGate ANTS
Have you looked at this question: How to profile a silverlight application?
Are you looking for something other than this?
Telerik also has a pretty fantastic product for profiling named : JustTrace
JustTrace enables the profiling of local applications, running applications, Silverlight applications and local ASP .NET web site.

Code Profiling ASP.NET MVC2 applications

The thread here seems close:
Profiling ASP.NET websites with EQATEC Profiler
However, in the free version of Equatec I downloaded today there is no checkboxes for ASP.NET, and ordinary web. I have pointed the App path to my bin directory in my project folder as well as started up the localhost hosting for my application via Visual Studio.
I am open to other free tools as well. I am just looking for someway to profile the code as to optimize some reflection we are using.
I am using the professional edition so unfortunantly do not have access to MS Code Profiling.
I am looking to do performance profiling at this point.
Is the free version of Equatec capable of doing ASP.NET applications?
Is there a free profiler (I realize this has been asked before, and little seems to have surfaced but paid apps, but might as well ask)?
Is MVC a special thing to look for in a profiler?
Comprehensive profiling tools still seem to be quite expensive. I like the dotTrace family, but they're not free.
You haven't specified what kind of profiling you want to do. Are you trying to understand more about the memory usage of your application, or CPU usage?
There is nothing special about MVC applications when it comes to profiling. You will need a profiler that's capable of launching ASP.NET. Beyond that, MVC is just a regular bunch of class libraries.
Have you tried the free CLR Profiler? It handles ASP.NET and will show both memory and some method call activity. It's not as comprehensive as say dotTrace, but it is a great free alternative if you're starting out.
The guide is actually not out of date: the few steps described in the stackoverflow duplicate question (last edited April 8th) still describes best how you should profile ASP.NET apps. Note that you should look at the accepted answer, the one with currently 16 upvotes.
After you've build the instrumented app the important thing to note in the stackoverflow-answer above is step 3: "load your app". It means that you should cause your app to be loaded and is the only step the profiler can't do automatically for ASP.NET apps.
You typically load the app simply by navigating to it in a browser so you simply need to do that after the build-step. When your (instrumented) code is activated the profiling part of it will spring into life and connect to the profiler and then you can take snapshots.
Note that ASP.NET doesn't need a main entry point. That's just an added convenience for automatically taking snapshots for real executables that has a Main method.
You just need a .NET profiler.
Profiling WebForms, MVC, SharePoint, Sitecore, Ektron, Sitefinity, or any other product that runs on .NET doesn't change that.

how to test aspx page behaviour when multiple requests(~50) are made simultaneously using visual studio

I have to test my asp.net web application for performance when there are simultaneous requests for the web site in my developer machine before deploy in production. how can i achieve this using Visual Studio?.(without using third party tools preferably Visual studio 2010 professional edition
You mentioned you only want to use Visual Studio but real benchmarking tools have very little to do with your IDE.
WCAT is quite useful.
I recommend of course you try this on a development or staging server, don't even think about trying this in a live environment!
If you look here you'll note that load testing doesn't come with VS 2010 Professional.
Since you've removed Third Party tools you're left with rolling your own. This will require that use threads to make calls to your web app via the HttpRequest object.
Rolling your own would likely cost your business more than what your time costs.
I'd note that load testing on your developer machine tells you squat in most cases. The environment is vastly different enough that the only thing you can usually figure out is "do we have a race condition here with more than one simultaneous request to this app?"
Best bet is to use a real load testing tool or service on a setup that mirrors your production environment as much as possible. For new apps, consider using the production environment before you go live for this.
I'll also note you should use a third party tool over rolling your own.

Categories

Resources