Compartilhar via


Web service calls and performance

While on the subject of performance... Have you ever wondered why the first call to a method on a Web service takes more time than subsequent calls? The first time a method on a Web service is called causes the soap client to reflect over the Web service proxy object. To mitigate this delay declare the Web service object global to the class and call a simple web method on the Web service during form load. Subsequent calls will not incur this reflection overhead.

Comments

  • Anonymous
    March 28, 2004
    That's worth knowing.
    Purely by coincidence a lot of my web service clients are structured that way anyway because they're obtaining initial configuration or option information on load.
    I think this may influence the way I design web services from now (make sure whenever possible that there's something useful I can call initially).
    Am I right in thinking it would help if that first call could be made asynchronously?
  • Anonymous
    March 28, 2004
    Yep, making the first web method call asynchronously will help to speed up your form's load time.
  • Anonymous
    March 28, 2004
    This is something I've always noticed but never really looked into. While on the subject of performance... Have you ever wondered why the first call to a method on a Web service takes more time than subsequent calls? The first time a method on a Web service is called causes the soap client to reflect over the Web service proxy object. To mitigate this delay declare the Web service object global to the class and call a simple web method on the Web service during form load. Subsequent calls will not incur this reflection overhead. [Jono's Blog]...