Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does a WCF self hosted service handle more or less load than the IIS hosted option?

Tags:

Does the hosting option affects the amount of requests a WCF service can handle?

like image 851
Jader Dias Avatar asked Aug 08 '09 15:08

Jader Dias


People also ask

What is difference between self hosting and IIS hosting?

Hosting a Web API inside IIS is quite straightforward as the process is identical to hosting a web application. On the other hand, hosting a Web API in it's own process requires the creation of a host application and is referred as self-hosting.

What is self hosting in WCF?

This is referred to as a self hosting WCF service, the exact meaning of Self Hosted is that it hosts the service in an application that could be a Console Application or Windows Forms and so on. Earlier we saw what a WCF Service is in the . Net environment. We can host a WCF service in IIS and a Windows service also.

Which of the following are the reason for activating or hosting a WCF service?

Hosting a WCF service in Windows Activation Service (WAS) is most advantageous because of its features such as process recycling, idle time management, common configuration system, and support for HTTP, TCP, etc.


2 Answers

Hard to say - the main reason for self-hosting is probably having more control, e.g. being able to tweak the system as you need it.

IIS hosting is convenient and easy to set up, and it offers "on-demand" loading of the service, e.g. the service host is only loaded if a request actually comes in.

This constant loading (and unloading) of the service host will probably hurt performance a little bit - on the other hand, self-hosting a service host, you probably use more memory (since the ServiceHost is active and in memory at all times).

So again - it's a memory-vs-speed trade-off - selfhosting uses more RAM but is probably a tiny bit faster.

Marc

like image 123
marc_s Avatar answered Oct 11 '22 19:10

marc_s


Once the service is running I would expect no significant difference.

But, as with any performance question, you can only get a useful answer by testing your service in both cases with realistic loads and looking at the big picture. E.g. one might server a few more requests but at a slightly higher memory cost.

There are of course going to be other differences e.g. IIS hosting, with on demand instantiation, would be expected to be a little slower to serve the first request from idle, whether this is significant only you can tell.

like image 20
Richard Avatar answered Oct 11 '22 18:10

Richard