开发者

What is the holdup on the first WCF call via the serviceProxy?

There are a lot of similar questions, but they all deal with server-side slowness - this is all about client-side issues.

1st call takes 900ms. 2nd call takes 20 ms.

I narrowed the slowness on the first call to serviceProxy.Method(). Fiddler reports that the actual time on the wire for the 1st call is 16 ms. Since the 2nd call is massively faster, I am forced to conclude the problem occurs with some WCF client-side instantiation code that fires when the first method call takes place.

Facts:

  • The connection to the server occurs via wsHttpBinding
  • The objects are encoded with the Protobufs.NET library by Marc Gravell
  • Questions here on SO that do address client-side issues like mine recommend ma开发者_高级运维king the 1st call on a background thread to just get the slowness out of the way. However, that's addressing the symptoms, not the underlying cause.

Any ideas why the slowdown occurs on the 1st post?


A common server slowness on start is IIS app pool spin up but in your question you stated that even though the first request was 900 ms, only 16 ms was spent on the server request according to fiddler. If that's true, it suggests something is going on client side.

One possibility is that some client apps that serialize objects generate and compile serialization code for those data types at runtime, which can result in slow start-up performance

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

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

I'm not familiar with protobuffs but compiling serialization code is trade off which makes the first call significantly slower but makes subsequent calls faster.

Not sure if that's your initial cost but it's a possibility.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜