Thomas
Thomas

Reputation: 2984

WCF vs. Sockets performance

I'm currently reading into WCF and also Sockets (here and on MSDN).

From what I saw WCF is slower than sockets but easier to use.

With the following Situation:

The target of mine is that all communication is handled as safe as possible (safe in terms of Problems like exceptions, timeouts, ...), and that ist easy to maintain the program.

Also the less data Transfer intense requests/Responses Need to be fast (thus only a few KB of data transferred).

My question here is, with WCF being slower than sockets.....would WCF still be fast enough to handle such a large System / Situation, or would sockets be the better way there?

Edit: As mentioned in the comments ASP.NET and other web based Solutions could also do These, so not only normal sockets but also websockets are of interest there (web sockets vs. wcf should not be much different than sockets vs. wcf).

Upvotes: 3

Views: 2059

Answers (1)

jason.kaisersmith
jason.kaisersmith

Reputation: 9610

Websockets work on a lower level than WCF, so it will also be 'faster' in that sense.

But first I would question if you really need this extra speed?
It is a bit like asking if you should buy a Ferrari instead of a Mini, because the Ferrari is faster.

Yes, but unless you always need to race around at 200+ km/h then you will not get any benefit, especially on roads where there is a 50km/h speed limit!

You need to first determine what you are real needs. The number of clients (500), and the size of an occasional large response is not going to make much difference. You need to determine how many requests you need to process per second. The average size of these requests. And then based on this your required bandwidth.

Remember, that the physical cables (or wifi network) operates at exactly the same speed, no matter what technology you use. So actually 'speed' is not the issue, but bandwidth or latency might be.

These problems are solved by having the right architecture to handle your requests. This means being able to scale out your application to cope with your demands.

So, you need to determine what is the bottleneck in your application. For example: Your sever will have to do something with the data it receives, maybe write it to a database. This could be your bottleneck, so then Websockets or WCF makes no difference to how many operations you can process per second.

Similarly, if your sever is single threaded then it doesn't scale, so again the technology used makes not difference and it is not your problem.

Maybe you are focusing too much on one aspect, rather than the bigger picture. I think you might have a bit of an XY problem here!

I did also found these, which might be interesting; https://msdn.microsoft.com/en-us/library/bb310550.aspx

WCF performance, latency and scalability

http://www.ganshani.com/blog/2014/02/optimizing-performance-of-your-wcf-services/

http://theburningmonk.com/2010/05/wcf-improve-performance-with-greater-concurrency/

I'm sure you can find more

Upvotes: 2

Related Questions