Multimobile Development: Building Applications for any Smartphone
Creation of "large" web service proxy object takes 10 seconds
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.performance.


Dave Morgereth
We have a web service that exposes approximately 40 methods and 40 typed
datasets. We used Visual Studio to create a Windows form client and added
web reference. Everything "works", but I've noticed that the initial
creation of the web service "proxy" object takes over 10 seconds. I assume
this is because the class created by Visual Studio when the web reference is
added is rather large.

public void CallMyService ( )
{
Service1.myService myService = new Service1.myService( ); <-- This
takes 10 seconds
MessageBox.Show (myService.HelloWorld()); <--
This takes 1 second
}

The first time CallMyService is invoked, the "new Service1.myService()"
takes over 10 seconds. On subsequent calls to CallMyService, it takes less
than 1 second. Actually invoking a web method ALWAYS takes 1 second.

I've tried ngen with little improvement. I've also tried using
threading/delegates to overlap the proxy creation with other "housekeeping"
that we have to do, also with little improvement. Is there any way to
improve this?

TIA
Dave

Reply to this message...
Vote that this is a GOOD answer...
 
Really good experience at the Apple Store
MonoDroid – looking *awesome*
 
    
Dev Eloper
I suggest you run a profiler and see what takes time when creating
an instance of the proxy (or make the proxy available so anyone
here can try).

If you need to do this often in your program, keep a pool of
proxies so you don't need to re-create them.

"Dave Morgereth" <Click here to reveal e-mail address> wrote in message news:OLm68UcMCHA.2256@tkmsftngp13...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First volume of Multimobile Development nearly ready to go to press
A mention on Developing for the iPhone and Android: The pros and cons
 
    
3ddA
Hello!

We have the same problem, but with a webservice of 50 methods and around 60
classes the creation of the web service proxy object can take up to 20
seconds on my 350MHz machine.

Profiling:
The main problem seems to be in the
System.Web.Services.Protocols.SoapHttpClientProtocol constructor which takes
about 99% of the time. In this method a child method named
System.Xml.Serialization.XmlSerializer.FromMappings takes 95% of the time.

Is there anyway that I can make this process execute faster?

/Regards 3ddA

Reply to this message...
Vote that this is a GOOD answer...
 
 
    
Dave Morgereth
I used Compuware's profiler and learned (not surprisingly) that the bulk of
the time is spent in the constructor for the proxy. It looks like most of
the time is spent in the ..ctor and .InitClass methods of the DataTables
exposed by our typed DataSets. We do not explicitly call the .ctor and
..InitClass methods, so they must be being called as part of the constructor
for the proxy.

The proxy is implemented as a singleton (ie we keep the proxy around so that
it doesn't have to be re-created). My goal is to reduce the amount of time
it takes for our app to start.

"Dev Eloper" <Click here to reveal e-mail address> wrote in message
news:#caw0SoMCHA.2420@tkmsftngp11...
[Original message clipped]

Reply to this message...
Vote that this is a GOOD answer...
 
First chapters of Multimobile Development book now available on Apress Alpha program
iPad
 
 
System.Web.Services.Protocols.SoapHttpClientProtocol
System.Windows.Forms.MessageBox
System.Xml.Serialization.XmlSerializer




Multimobile Development: Building Applications for any Smartphone
Ad
BootFX
Reliable and powerful .NET application framework.
iOS, Android and Windows Phone Development Training and Consultancy
Hosted by RackSRV Communications
 
Multimobile Development: Building Applications for any Smartphone
Copyright © AMX Software Ltd 2008-2010. Portions copyright © Matthew Baxter-Reynolds 2001-2010. All rights reserved.
Contact Us - Terms of Use - Privacy Policy - 4.0.30129.1734