开发者

How to speed up start up performance of WCF client

I have implemented a simple standalone WCF service with a basicHttpBindi开发者_高级运维ng binding. I created a client and generated the client stub code by using Add Service Reference. The first time the client call the service it takes at least 15 seconds before the server sees the request. From reading this it seems that it is due to JIT generation of serialization code. I tried to pre-generate the code as described here using

svcutil.exe /t:xmlSerializer <assemblyPath>

on my complied client exe but code but got the following error: No service contract in the assembly has an operation with XmlSerializerOperationBehavior.


First of all, you should note, that if you are using precompiled code, you will lose performance, as precompiled code doesn't use any platform-specific, it just compiles a "normal" code.

On other hand, JIT really get some performance hit at the first-time compilation (for the proxy-class creation), but it really works better at futher requests.

So I suggest you to check the initialization code for your service and client - may be, you can optimize it (15 seconds means that you are creating much number of objects from various assemblies).

Try to use some Lazy classes

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜