3

WCF の通信バインディング タイプとしてトランスポート セキュリティ (https) で netTcpBinding と WsHttpBinding を使用するシナリオを実装しました。次に、パフォーマンス結果を比較しました。興味深いことに、netTcpBinding は wsHttpBinding よりも低速でした。私はバインドのパフォーマンスに関する多くのドキュメントを読みましたが、netTcpBinding がバイナリ エンコーディングにより最速の通信を提供することを知っています。

私のテストでこの状況を引き起こす原因を説明できますか? ありがとう。

テスト環境: IIS 7

public static WSHttpBinding GetWSHttpForSSLBinding()
{
   WSHttpBinding binding = new WSHttpBinding();
   binding.TransactionFlow = true;
   binding.MaxReceivedMessageSize = 2147483647;
   binding.MessageEncoding = WSMessageEncoding.Text;
   binding.Security.Mode = SecurityMode.Transport;
   binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
   binding.ReaderQuotas.MaxStringContentLength = 2147483647;
   binding.OpenTimeout = TimeSpan.MaxValue;
   binding.CloseTimeout = TimeSpan.MaxValue;
   binding.SendTimeout = TimeSpan.MaxValue;
   binding.ReceiveTimeout = TimeSpan.MaxValue;
   return binding;
}

public static NetTcpBinding GetTcpBinding()
{
   NetTcpBinding binding = new NetTcpBinding();
   binding.TransactionFlow = true;
   binding.MaxReceivedMessageSize = 2147483647;
   binding.PortSharingEnabled = true;
   binding.Security.Mode = SecurityMode.Transport;
   binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
   binding.Security.Transport.ProtectionLevel = ProtectionLevel.EncryptAndSign;
   binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
   binding.Security.Message.AlgorithmSuite = SecurityAlgorithmSuite.TripleDesSha256;
   binding.ReaderQuotas.MaxStringContentLength = 2147483647;
   binding.ReaderQuotas.MaxArrayLength = 2147483647;
   binding.OpenTimeout = TimeSpan.MaxValue;
   binding.CloseTimeout = TimeSpan.MaxValue;
   binding.SendTimeout = TimeSpan.MaxValue;
   binding.ReceiveTimeout = TimeSpan.MaxValue;
   return binding;
}
4

2 に答える 2

3

net.tcp バインディングは認証を使用しますが、ws http バインディングは使用しません。また、単一のプロキシからの複数の操作呼び出しと、より大きなメッセージ負荷でテストを繰り返します。チャネルの作成と接続の確立のため、最初の呼び出しは常に遅くなります。

于 2010-09-23T10:55:45.417 に答える
2

レイテンシーまたはスループットについて話しているのですか。クライアントは接続を作成してすぐに閉じますか、それとも複数の呼び出しにまたがりますか。

NetTcp は同じ接続で最適化されており、wshttp に BinaryEncoding と TextEncoding を使用するため、ペイロード サイズは小さくなります。

レイテンシーを見ている場合 - NetTcp は Windows 認証を行い、SSL 認証を使用している wshttp に対して AD ルックアップを引き起こします。

于 2010-09-23T23:39:46.080 に答える