Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service hosted in a Console Application

How much load can a WCF service, hosted in a console application handle? Can it handle incoming requests as much as a WCF hosted on IIS?

Additional Notes: Can requests arrive concurrently?

I have a WCF service hosted in a console app. I call this WCF service from within a web app. That web app may have hundreds of requests concurrently.

I have simulated a load of requests but I couldn't find out if the console app which hosts the WCF service is actually answering them concurrently or sequentially.

like image 631
Kaveh Shahbazian Avatar asked Feb 20 '23 23:02

Kaveh Shahbazian


1 Answers

It doesn't matter where the WCF service is hosted. It all depends on the binding, endpoint, endpoint behavior and service behavior settings and, last but not least, on the way you set (via attributes) the instancing mode and concurrency type for your service.

These settings are taken over by the ServiceHost instance. Even if it's running in a console app, the application itself is just a container for the ServiceHost which is the one that creates the runtime environment for your WCF service, based on the settings you give it.

For what interests you, see here (concurrency and throttling). Also, something very extensive on WCF instance modes.

For performance reasons I recommend you use a singleton service, which you can specify via the InstanceContextMode. If you have hundreds of requests coming in, it won't do any good to concurrency if a service instance is created for each request. You have to analyze if singleton is possible in your case by checking if all your service operations are thread safe.

like image 190
Marcel N. Avatar answered Feb 26 '23 21:02

Marcel N.