What is hold on first call of WCF through serviceProxy?

There are many similar questions, but they all deal with server-side slowness β€” all about client-side issues.

1st call takes 900 ms. The second call takes 20 ms.

I narrowed the slowness on the first call to serviceProxy.Method (). Fiddler reports that the actual wire time for the first call is 16 ms. Since the second call is much faster, I am forced to complete this problem with some WCF client-side instance code that starts when the method is first called.

Data:

  • Connection to the server occurs through wsHttpBinding
  • Objects encoded by the Protobufs.NET library by Mark Gravell
  • The questions here regarding SO, which relate to client-side issues such as mine, recommend making the first call in the background thread, just to get rid of the slowness. However, this is about the symptoms, not the root cause.

Any ideas why the slowdown is in 1st place?

+4
source share
1 answer

Bypassing the server at the start of the launch is an IIS application pool, but in your question you stated that although the first request was 900 ms, only 16 ms was spent on the server request in accordance with the firewall. If true, this suggests that something is happening on the client side.

One possibility is that some client applications that serialize objects generate and compile serialization code for these data types at runtime, which can lead to slower startup performance.

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

http://msdn.microsoft.com/en-us/library/ms733901.aspx

I am not familiar with protobuffs, but compiling the serialization code is a compromise, which makes the first call much slower, but speeds up subsequent calls.

Not sure if this is your initial cost, but it is an opportunity.

+2
source

All Articles