How do I profile a WCF service? - wcf

I am in the process of performance testing the entire system. I used SlimTune on some Winform Applications in order to identify bottlenecks and I like it, it was very simple to use and understand.
Now I want to do the same over some WCF services (all self hosted).
What Tools should I use? (free tools please)
Is there any way to use SlimTune for this?

The following thread asks the same question and has some good advice.
How to get started with WCF Performance profiling

Related

Consume WCF service from go application

Is it even possible more or less natively consume WCF service from Go application?
I can imagine it should be possible to execute SOAP calls in Go, but WCF is a bit more than that only, for example authorization will probably be a problem also...
Have anyone at least approached this area, or maybe someone can give useful me advice in this "wheel reinvention task"?
Thank you in advance for all your input, ideas and suggestions.
I think you should expose a RESTful Service. I myself have the problem with exposing a WCF Service too many clients using PHP, Go, Ruby and all kind of languages. We never ever got it right, to automatically generate a proxy.
The maybe simplest way is to use WCF, like described in this example:
https://www.codeproject.com/Articles/105273/Create-RESTful-WCF-Service-API-Step-
By-Step-Guide
But I recommend to switch to ASP.NET Core (Migration is not that hard) or if you have the budget I would consider https://servicestack.net/
It may be well beyond the wait time for this. However, here is something really interesting that could help. The situation the authors found themselves is relevant even today in some organizations.
https://github.com/khoad/msbingo
Here's the motivation provided by the authors:
Application/soap+msbin1 encoding was a blocking issue for modernizing services from WCF to platform-agnostic technologies such as Go. We needed to be able to make calls to dependency services that spoke msbin1 and were not going to be updated or even reconfigured, but we did not want to introduce unnecessary complexity such as workarounds like .NET-based WCF request translator proxies or deploying Mono with our service instances. Initially we tried the Mono deployment route, which, while it would have worked well enough, significantly complicated our deployment pipeline, thus erasing one of the major advantages of golang.
I found it a useful starting point to begin experimentation.

Is creating a WCF service host an expensive process?

I want to host multiple WCF services in windows service but I am unsure if hosting multiple WCF services is an expensive process? Can someone please guide?
It depends on the complexity of the service itself, but generally, they are not resource intensive.
It will also depends of the number of connected clients and requests you will get.
The rule is very simple here. You need to decompose your system requirements into the right level of granularity that minimizes the cost of implementation versus the cost of integration. Too many services and your integration costs will suffer. Too few services and your implementation costs will suffer. My personal experience is that if any service has more than 10 methods you really need to start looking into your design and the methodology you have used to design it like that. Also please note that services with too many methods do not scale that well neither.

How to get started with WCF Performance profiling

I'm trying to figure out how to profile a WCF service so I can identify any bottlenecks.
I have found a bit of information on line, but nothing that assumes no prior knowlege which is where I'm at.
What are recomended FREE tools?
- visual studio tools
- clrprofiler
Here is information I found using vsperfcmd.exe to profile wcf service and according to this it is very simple, but I need to fill in the gaps on where to start. My assumptions are to copy VsPerfCLREnv and VsPerfCmd to the server that hosts my wcf service and perform some configuraiton steps that I'm not quite sure on. I'm also not quite sure how I would be able to see the call stack to evaluate the performance of each call.
clrprofiler seems a bit simpler. I assume I would copy clrprofiler.exe to the server, File->Profile Service and add the name and start/stop commands. (is this a friendly name or filename or the service display name?) I assume I would then run my tests against the service and I could see the call stack in clrprofiler. Does that sound correct?
[edit]
I'm not so interested in testing the network since this is on a test server, and this is a large wcf project with multiple devs on it and I am unable to make changes to the project for the sole purpose of monitoring the performance. I want to focus on the performance of the actual methods within it.
Any assistance on getting started is greatly appreciated.
For WCF it is not enough to profile your code only as bunch of things happen on the channel stack (security, deserialization, formatting etc). A good way to visualise that is by using WCF Tracing at verbose level and then using the service trace viewer to see how long it is taking at each step of message processing. Read here on how to configure and use WCF tracing. This is the single most thing that has hepled me with diagnosing WCF issues.
Of course all other code profiling, DB profiling etc. are valid approach as well. You may even use a tool like SoapUI to test your network communication and client side performance overhead for a more end-to-end benchmark.
some things I've learned that someone might find helpful:
you cannot remote profile a service, even over your local network. The profiler must be running on the same machine as the service. (This actually took me quite a while to figure out. Maybe obvious to you, but it was never spelled out so I kept trying to do it)
Visual Studio didn't work for me to profile my WCF service. I was able to get a bit of help from the VS profiler team, but never came out of it with a working solution.
VS was slow to connect and disconnect the profiler and often instrumented my binaries and left them in a corrupted state.
.net binaries do not need to be instrumented since they contain the metadata of the methods which is odd that visual studio kept hosing my binaries trying to instrument them.
I also tried the VS standalone profiler but this is very complex to use and requires reboots of my server.
I ended up getting an internal profiler to work (after getting a private build from the team) so I'm not sure how many profilers out there are designed to work with a WCF service.
I actually set the profiler to watch the WAS service and then added my additional binaries to the profiler.
process explorer is useful when troubleshooting if the profiler is connected or not. Use it to look at inetinfo.exe environment
Can you run it under a debugger?
Can you stand a simple, old-fashioned, method that just works? Here's one.
In addition to Mike's comments, you can use the built-in WCF performance counters to see a number of performance-related metrics and you can also see call times on a WCF trace. Once you know which operations are 'slow' it's usually easier to add some custom timing/logging code to those operations than using a general purpose profiler for something like this. This coming from someone who used to work on commercial profilers.
Tools you should look into: svctracelogviewer (and turn on tracing in both your service and clients). SoapUI for simulating load (and do analysis) and Fiddler, an excellent HTTP sniffer/diagnostics tool.

Regarding Creating Business application using Silverlight

We are in the conceptual phase to create a relatively medium size enterprise business product application using Silver light 4.0, Entity Framework and WCF.
1. Is it adivceable to use Silverlight 4.0 for this enterprise business application development or should we go in for MVC.NET / ASP.NET?
2. We have planned to use REST based WCF service. How complex would it be to write the information back to the REST WCF service?
I appreciate and welcome your advice / suggestion. If you need any further details do let me know, i will be happy to share.
Thanks in advance.
If ASP.NET (MVC) and Silverlight are my only choices, I'd take Silverlight.
If you were to choose ASP.NET (alone), remember that MVC isn't your only option. While MVC 2 is the hot ticket on the block, so to speak, WebForms is still being advanced and actively developed and supported by Microsoft.
Also, if you're going to be using Silverlight, you'll be using web pages anyway (at least one) and it's certainly conceivable (possibly desirable) to compartmentalize it such that you can use both.
Having said that, I would honestly recommend WPF over Silverlight for enterprise development unless it's absolutely necessary for it to be cross-platform. It's what it was built for and allows you to completely unleash the capabilities of the OS, not the least of which being that it opens up every security option WCF offers.
As for your question about how easy it is to write information back to a REST WCF service, I suppose the answer to that is relative to how good a developer you are. :) Honestly, it's pretty easy though. Specifically, I'd look into WCF RIA services for that sort of thing.
For Line-of-business apps i will prefer Silverlight. but if you are going for SL4 them i think you should also consider this:
http://christopherdeweese.com/blog2/post/using-silverlight-4-to-browse-netflixs-odata-catalog
Microsoft recently introduced OData as an alternate to WCF. I haven't played much with OData but its easy to work on REST based services but full control over it. I think you should further investigate your options and consider OData as well.
Regards.

WCF or other technologies for load balancing

I would like to write an upload system (photos, videos,...), which could be scaled and perform well even under heavy traffic.
I am a .Net developer therefore I am more interested in using .Net technologies to achieve this. But I am also open to other technologies that I could use for this project.
I am also thinking about Azure OS from Microsoft, If I use Azure then I probably would not need to be worried about anything, right ? it will scale itself automatically and I probably would not need to program that part, but its closed source and they can raise the prize at any time.
I am absolutely new to load balancing therefore I don't know where to start? I need to decide a system like www.flickr.com
Any ideas folks ?
Thanks.
I would look into a messaging queue like MSMQ.