Web Services (ASMX 1.1) Performance Checklist
From Guidance Share
Jump to navigationJump to search
J.D. Meier, Srinath Vasireddy, Ashish Babbar, Rico Mariani, and Alex Mackman
Design Considerations
- Design chunky interfaces to reduce round trips.
- Prefer message-based programming over remote procedure call (RPC) style.
- Use literal message encoding for parameter formatting.
- Prefer primitive types for Web service parameters.
- Avoid maintaining server state between calls.
- Consider input validation for costly Web methods.
- Consider your approach to caching.
- Consider approaches for bulk data transfer and attachments.
- Avoid calling local Web Services.
Connections
- Configure the maxconnection attribute.
- Prioritize and allocate connections across discrete Web services.
- Use a single identity for outbound calls.
- Consider UnsafeAuthenticatedConnectionSharing with Windows Integrated Authentication.
- Use PreAuthenticate with Basic authentication.
Threading
- Tune the thread pool using the formula for reducing contention.
- Consider minIoThreads and minWorkerThreads for intermittent burst load.
One Way (Fire and Forget) Communication
- Consider using the OneWay attribute if you do not require a response.
Asynchronous Web Methods
- Use asynchronous Web methods for I/O operations.
- Do not use asynchronous Web methods when you depend on worker threads.
Asynchronous Invocation
- Consider calling Web services asynchronously when you have additional parallel work.
- Use asynchronous invocation to call multiple unrelated Web services.
- Call Web services asynchronously for UI responsiveness.
Timeouts
- Set your proxy timeout appropriately.
- Set your ASP.NET timeout greater than your Web service timeout.
- Abort connections for ASP.NET pages that timeout before a Web services call completes.
- Consider the responseDeadlockInterval attribute.
WebMethods
- Prefer primitive parameter types.
- Consider buffering.
- Consider caching responses.
- Enable session state only for Web methods that need it.
Serialization
- Reduce serialization with XmlIgnore.
- Reduce round trips.
- Consider XML compression.
Caching
- Consider output caching for less volatile data.
- Consider providing cache-related information to clients.
- Consider perimeter caching.
State Management
- Use session state only where it is needed.
- Avoid server affinity.
Attachments
- Prefer Base64 encoding. Direct Internet Message Encapsulation (DIME) is a supported part of Web Services Enhancements (WSE), but Microsoft® is not investing in this approach long-term. DIME is limited because the attachments are outside the SOAP envelope.
COM Interop
- Avoid single-threaded apartment (STA) COM objects.