views:

36

answers:

2

Hi All, I met a performance issue when using the WCF service.

Here's the story:

  1. I wrote a self-hosted WCF service which is hosted by a console application;

  2. I wrote a simple client to consume the service;

  3. After the WCF service is running, it takes over 15 seconds for the client to create connection with the service.

The WCF service is extremely simple just something like "Hello World". Is this normal?

A: 

This should help: http://msdn.microsoft.com/en-us/library/aa751883.aspx

If you host on IIS, that takes a while to start up no matter what.

Iain Ballard
I didn't design any serialization/deserialization methods inside, just return an integer value from the service. And the service is hosted within a console application.
Karla
WCF has it's own contract [de]serializers -- even if you're just sending basic data types. Having said that, WCF's first startup has been slow on my systems no matter what I've tried. I use IIS hosting, so just turn off periodic App Pool cycling.
Iain Ballard
+1  A: 

One way could be to add your own warmup script; a script that calls your service on initial load.

Though, this answer might help you, usually, the first access to the service is slow, but the consecutive accesses would be within a sec or two.

The first slow response is related to the JIT compilation of the service assemblies; which means its normal.

Alternatively, you may want to Profile you app. Also you may would like to checkout this article that I wrote some time back.

KMan