SlideShare une entreprise Scribd logo
1  sur  2
Optimizing Web Service Design


Web services are always called remotely and are typically invoked using a SOAP
request. This architecture by design creates a process boundary that automatically
degrades the responsiveness of the Web service. In addition, Web services and their
consumers are forced to take the extra processing step of assembling and parsing
SOAP requests. By their nature, Web services will not respond as fast as locally
installed components, so it is extra important that you take steps to maximize the
performance of your Web service. You can do so with a few simple design
optimizations:

Use asynchronous Web method calls where possible: Asynchronous calls are
ideal for intensive Web methods that take a significant time to process and where
the consumer application has the flexibility to work on other things while it waits for
a response from the Web service.

Use timeouts for synchronous calls: Web methods should contain built-in
timeouts in case the Web method hangs or takes an unusually long time to execute.
This will prevent the client application from hanging indefinitely while it waits for the
Web service call to return. In addition, you can set the Timeout property explicitly on
the Web service client proxy class. Web service proxy classes implement a common
base class called WebClientProtocol, which in turn provides a Timeout property.

Use output caching for responses: Output caching will improve the
responsiveness and performance of a Web method. The WebMethod() attribute
provides a CacheDuration property that specifies the number of seconds to cache an
output response. Web service output caching varies by parameter, so users with
different requests parameters will not receive the same cached response.

Minimize traffic: Cross-process calls are expensive, so you should minimize the
amount of traffic that flows between a Web service and its consumer. Use fewer Web
methods that return more information vs. more Web methods that return limited,
granular information. Avoid multiple consecutive Web method calls if you can
accomplish the same result using a single Web method that returns more
information.

Minimize use of complex data types: Complex data types such as the ADO.NET
DataSet provide a sophisticated level of information but come with a performance
price. The DataSet object, for example, serializes to a large chunk of XML that
requires intensive processing to serialize and to parse. By all means use these
complex types if they make the most sense. But if they are not needed, then you are
better off using simple types. For example, in our Web methods we typically map the
contents of a DataSet to an array of simple types, such as an array of strings. This
creates a smaller footprint than a serialized DataSet object.

Use SOAP Headers for global information: If your Web service uses SOAP as its
communication protocol, then you should consider using SOAP headers for passing
certain types of information. SOAP headers are included within a SOAP envelope, but
they are not tied to a specific Web method message. SOAP headers are useful for
passing global values that apply to all Web methods. They generate a small footprint
and do not clutter the WSDL definitions for individual Web methods. In addition,
SOAP headers are useful for passing authentication information between a Web
service and a consumer.

Use client-side invocation: You have seen techniques for invoking Web services
from client-side script using the WebService DHTML behavior. Client-side invocation
minimizes server postbacks and may be the most efficient way to process user input,
especially on pages with large view state or pages that accept input but do not
display much information. For example, we typically design form input screens to
process the update with a Web service. This design updates the information quickly
and the form can be refreshed quickly using a client-side script.

Code intelligently: Web services are simply another type of .NET application, so
you should follow the same smart coding conventions that you use in other kinds
of .NET applications. The conventions include, but are not limited to, the following:
use early binding for object references, release object references as soon as you are
done with them, and use casting to convert object references from one data type to
another.

Compile intelligently: ASP.NET automatically leverages the .NET Framework’s
optimized runtime system, which uses Just-In-Time (JIT) compilation to keep
components loaded in memory only for as long as they are needed. Keep your Web
services small and ensure that your Web methods remain logically partitioned
between several Web services rather than in one large Web service. There is no
quantitative measure to guide you here, besides stress testing results. Qualitatively,
you can keep your Web services more responsive if they are smaller and can be
loaded quickly by the JIT compiler. Remember to always switch the project’s Build
Configuration from Debug to Release before deployment. This will result in a smaller,
faster executable that implements all of the chosen optimizations from the project
property pages.

As a final thought, you may want to consider using .NET remoting as an alternative
to Web services. .NET remoting is a technology for distributed programming that
uses SOAP as one available protocol choice, in addition to binary remoting over
TCP/IP. .NET remoting is a useful technology for passing binary objects across
process boundaries, and it is usually much more efficient than Web services if you
are generating complex objects and do not need to use SOAP. The .NET Framework
provides efficient design patterns for .NET remoting solutions that provide
sophisticated functionality with relatively little code.



Author Bio: Spec India is a Custom Software Application Development and Software
Solutions Company based in Ahmedabad, India. Our Services includes iPhone
Application Development, Android Application Development, ORACLE, .Net, and
Mobile Computing.

Contenu connexe

En vedette

L'IoT, c'est maintenant. Microsoft Experiences 2016
L'IoT, c'est maintenant. Microsoft Experiences 2016L'IoT, c'est maintenant. Microsoft Experiences 2016
L'IoT, c'est maintenant. Microsoft Experiences 2016Alex Danvy
 
Machine learning, deep learning et search : à quand ces innovations dans nos ...
Machine learning, deep learning et search : à quand ces innovations dans nos ...Machine learning, deep learning et search : à quand ces innovations dans nos ...
Machine learning, deep learning et search : à quand ces innovations dans nos ...Antidot
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Olivier Le Goaër
 
An overview of standards and related technology in web services
An overview of standards and related technology in web servicesAn overview of standards and related technology in web services
An overview of standards and related technology in web servicesPapa Cheikh Cisse
 
SOAP-UI The Web service Testing
SOAP-UI The Web service TestingSOAP-UI The Web service Testing
SOAP-UI The Web service TestingGanesh Mandala
 
Postman - Dev/var 15
Postman - Dev/var 15Postman - Dev/var 15
Postman - Dev/var 15Jonathan SAEZ
 

En vedette (9)

L'IoT, c'est maintenant. Microsoft Experiences 2016
L'IoT, c'est maintenant. Microsoft Experiences 2016L'IoT, c'est maintenant. Microsoft Experiences 2016
L'IoT, c'est maintenant. Microsoft Experiences 2016
 
Machine learning, deep learning et search : à quand ces innovations dans nos ...
Machine learning, deep learning et search : à quand ces innovations dans nos ...Machine learning, deep learning et search : à quand ces innovations dans nos ...
Machine learning, deep learning et search : à quand ces innovations dans nos ...
 
Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !Les Web Services en 60 diapos chrono !
Les Web Services en 60 diapos chrono !
 
An overview of standards and related technology in web services
An overview of standards and related technology in web servicesAn overview of standards and related technology in web services
An overview of standards and related technology in web services
 
Deeplearning NLP
Deeplearning NLPDeeplearning NLP
Deeplearning NLP
 
SOAP-UI The Web service Testing
SOAP-UI The Web service TestingSOAP-UI The Web service Testing
SOAP-UI The Web service Testing
 
XebiConFr15 - Les algorithmes du machine learning
XebiConFr15 - Les algorithmes du machine learningXebiConFr15 - Les algorithmes du machine learning
XebiConFr15 - Les algorithmes du machine learning
 
Deeplearning in finance
Deeplearning in financeDeeplearning in finance
Deeplearning in finance
 
Postman - Dev/var 15
Postman - Dev/var 15Postman - Dev/var 15
Postman - Dev/var 15
 

Dernier

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Dernier (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Optimizing web service design

  • 1. Optimizing Web Service Design Web services are always called remotely and are typically invoked using a SOAP request. This architecture by design creates a process boundary that automatically degrades the responsiveness of the Web service. In addition, Web services and their consumers are forced to take the extra processing step of assembling and parsing SOAP requests. By their nature, Web services will not respond as fast as locally installed components, so it is extra important that you take steps to maximize the performance of your Web service. You can do so with a few simple design optimizations: Use asynchronous Web method calls where possible: Asynchronous calls are ideal for intensive Web methods that take a significant time to process and where the consumer application has the flexibility to work on other things while it waits for a response from the Web service. Use timeouts for synchronous calls: Web methods should contain built-in timeouts in case the Web method hangs or takes an unusually long time to execute. This will prevent the client application from hanging indefinitely while it waits for the Web service call to return. In addition, you can set the Timeout property explicitly on the Web service client proxy class. Web service proxy classes implement a common base class called WebClientProtocol, which in turn provides a Timeout property. Use output caching for responses: Output caching will improve the responsiveness and performance of a Web method. The WebMethod() attribute provides a CacheDuration property that specifies the number of seconds to cache an output response. Web service output caching varies by parameter, so users with different requests parameters will not receive the same cached response. Minimize traffic: Cross-process calls are expensive, so you should minimize the amount of traffic that flows between a Web service and its consumer. Use fewer Web methods that return more information vs. more Web methods that return limited, granular information. Avoid multiple consecutive Web method calls if you can accomplish the same result using a single Web method that returns more information. Minimize use of complex data types: Complex data types such as the ADO.NET DataSet provide a sophisticated level of information but come with a performance price. The DataSet object, for example, serializes to a large chunk of XML that requires intensive processing to serialize and to parse. By all means use these complex types if they make the most sense. But if they are not needed, then you are better off using simple types. For example, in our Web methods we typically map the contents of a DataSet to an array of simple types, such as an array of strings. This creates a smaller footprint than a serialized DataSet object. Use SOAP Headers for global information: If your Web service uses SOAP as its communication protocol, then you should consider using SOAP headers for passing certain types of information. SOAP headers are included within a SOAP envelope, but they are not tied to a specific Web method message. SOAP headers are useful for passing global values that apply to all Web methods. They generate a small footprint and do not clutter the WSDL definitions for individual Web methods. In addition,
  • 2. SOAP headers are useful for passing authentication information between a Web service and a consumer. Use client-side invocation: You have seen techniques for invoking Web services from client-side script using the WebService DHTML behavior. Client-side invocation minimizes server postbacks and may be the most efficient way to process user input, especially on pages with large view state or pages that accept input but do not display much information. For example, we typically design form input screens to process the update with a Web service. This design updates the information quickly and the form can be refreshed quickly using a client-side script. Code intelligently: Web services are simply another type of .NET application, so you should follow the same smart coding conventions that you use in other kinds of .NET applications. The conventions include, but are not limited to, the following: use early binding for object references, release object references as soon as you are done with them, and use casting to convert object references from one data type to another. Compile intelligently: ASP.NET automatically leverages the .NET Framework’s optimized runtime system, which uses Just-In-Time (JIT) compilation to keep components loaded in memory only for as long as they are needed. Keep your Web services small and ensure that your Web methods remain logically partitioned between several Web services rather than in one large Web service. There is no quantitative measure to guide you here, besides stress testing results. Qualitatively, you can keep your Web services more responsive if they are smaller and can be loaded quickly by the JIT compiler. Remember to always switch the project’s Build Configuration from Debug to Release before deployment. This will result in a smaller, faster executable that implements all of the chosen optimizations from the project property pages. As a final thought, you may want to consider using .NET remoting as an alternative to Web services. .NET remoting is a technology for distributed programming that uses SOAP as one available protocol choice, in addition to binary remoting over TCP/IP. .NET remoting is a useful technology for passing binary objects across process boundaries, and it is usually much more efficient than Web services if you are generating complex objects and do not need to use SOAP. The .NET Framework provides efficient design patterns for .NET remoting solutions that provide sophisticated functionality with relatively little code. Author Bio: Spec India is a Custom Software Application Development and Software Solutions Company based in Ahmedabad, India. Our Services includes iPhone Application Development, Android Application Development, ORACLE, .Net, and Mobile Computing.