user3844117
user3844117

Reputation: 21

Very slow first call to web service

I have a web application written in C# .NET 3.5 using Visual Studio 2010 that consumes a web service exposed by Websphere for z/OS. The web application is hosted on Windows Server 2008 64bit/IIS 7. The first call to the WS takes 155000 ms to execute, but the service responded in less than one second (verified on server). The subsequent calls to the WS takes about 45 ms. During the long running time, the worker process consumes all cpu and allocates more than 2Gb of memory. When it becomes responsive the memory allocated drop down to 250 Mb and subsequent calls take, as I said, about 45 ms. This behaviour doesn't happen on my workstation (Windows 7 64 bit) and on a server wtih Windows Server 2003 32 bit and IIS 6. I also tried to generate the serializers/deserializers with no effect. Any ideas?

Upvotes: 0

Views: 4097

Answers (1)

user3844117
user3844117

Reputation: 21

After a long time, I discovered that this is a problem related to 64bit environment and Microsoft knows the problem. I had no response from Microsoft for a solution. After a long search I found this article XmlSerializer startup HUGE performance loss on 64bit systems that says to add this parameter to the web.config:

<configuration>
  <system.diagnostics>
    <switches>
      <add name="XmlSerialization.Compilation" value="4"/>
    </switches>
  </system.diagnostics>
</configuration>

I tested this solution and the time taken to deserialize the soap stream has dropped to 2 seconds. Not so bad. The drawback is that the temp directory gets flooded by temporary files. Now the question is: why enabling this switch the time drops down? There is some other switch I can try without keeping the temp files?

Upvotes: 1

Related Questions