Download presentation
Presentation is loading. Please wait.
Published byMaude Barton Modified over 8 years ago
2
Justin Smith Technical Evangelist Microsoft Corporation http://blogs.msdn.com/justinjsmith CON301
3
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
4
Comparable to the following managed technologies.NET Remoting System.EnterpriseServices System.Messaging Faster than following Web Services ASMX (ASP.NET Web Service) WSE Great performance vs competition http://msdn2.microsoft.com/en-us/library/bb310550.aspx
9
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
10
WCF supports several transports (default) TCP, HTTP, MSMQ, NamedPipes Can customize for others Each transport has it’s own considerations MEP, reach, interop, overhead
12
Message type == XML Infoset Serializers bridge object graphs to Infosets WCF ships with 3 possibilities for serializers DataContractSerializer (DCS) NetDataContractSerializer (NDCS) XmlSerializer Interop can dictate which one to use Each serializer has performance traits (demo)
13
Message type == XML Infoset Encoders bridge Infoset to wire format WCF ships with 3 encoders (.NET 3.0) Text, MTOM, Binary.NET Fx 3.5 introduces JSON encoder Interop often dictates which one to use Binary fast, not interoperable MTOM for large binary payloads w/interop Text for most interop Each has performance traits (demo)
14
Binary significantly faster than text Can easily add a non interoperable endpoint side by side with an interoperate one MTOM comparable to binary Big messages: big impact Protocols converge to comparable throughput Small messages: small impact Most time spent in the protocol overhead
17
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
18
Svcutil can create a proxy type for a service Implements IClientChannel Overhead required to instantiate this type ChannelFactory also works Which one to use: Scvutil type simpler to use, more overhead ChannelFactory harder to use, less overhead Misused frequently!
19
Dispose unused proxies Can fill the throttle: client hangs Can run out of resources: sockets Don’t create a new Proxy for every call If Channel is stateful, reuse the ChannelFactory “Increasing Middle-Tier Client Performance” http://msdn2.microsoft.com/en-us/library/aa738757.aspx http://msdn2.microsoft.com/en-us/library/aa738757.aspx Async, Async, Async ! Don’t measure with Tracing on
22
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
23
Services are asynchronous The CPU is a terrible thing to waste ServiceModel conservative limits MaxConcurrent: Sessions == 10 Calls == 16 InstanceContext set to PerCall Singleton and Multiple require synchronization Binding specifies idle timeouts Lazy client defense ReceiveTimeout
25
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
26
Transfer large data Rule of thumb: 1-3 MB, then stream HTTP, TCP, NamedPipe transports only Can stream data to a service, from a service, or both Set TransferMode on Binding type Use System.IO.Stream in contract Set MaxReceivedMessageSize Default 64k
27
Windows and WCF buffer content Even in a streaming scenario WCF offers Nagle knobs to control buffers ConnectionBufferSize The preferred size of the local buffer MaxOutputDelay The Max time to let data sit AllowOutputBatching Enable batching within WCF
29
The Reward Transports, Serializers, and Encoders Client Options Service Options Streaming Common Questions
30
Not disposing unused Proxy Creating a new Proxy for every call Using security when unnecessary (Web) default for NetTcp/NetPipe/WSHttp Using default values for ServerThrottle MaxConcurrent: Sessions == 10 Calls == 16 Streamed contract with Buffered binding Stream if necessary: memory usage, big payloads Buffered faster for smaller payloads
31
SvcConfigEditor (really!) Diagnostic Traces: SvcTraceViewer Performance Counters Microsoft Visual Studio 2005 Team Suite Performance Tools Netmon Netmon 3.0 publicly available on http://connect.microsoft.com/ http://connect.microsoft.com/ Xperf/ETW http://msdn2.microsoft.com/en- us/library/aa363668.aspx
32
Don’t make assumptions: measure! Actual payloads have big impact Deployment can make a big difference Other applications competing for resources Network topology can cause delays (latency) Security (Active Directory, x509 & CRLs) Measure primarily end to end scenarios Use micro-benchmarks wisely
33
Transport NetPipe, NetTcp, BasicHttp, WSHttp Proxy Reuse ServiceChannel, reuse ChannelFactory. Security Transport, WS-* +MessageCredentials, Full WS-* Encoders Binary, MTOM, Text. JSON Compression, not built-in (GZipStream)
34
Hosting Self Host, Host in IIS Quotas/Throttles Increase but minimize Instancing/Concurrency Singleton/Multiple Transactions OleTx, WS-AT Queues Use Batching
37
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.