Does the hosting option affects the amount of requests a WCF service can handle?
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.
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.
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.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With