[英]How to optimize/design WCF for hundreds of concurrent connections?
我想使用WCF開發一個TCP服務器應用程序,該應用程序必須是高度可伸縮的高性能服務器,並且可以處理至少200個並發連接:從客戶端通過GPRS獲取原始數據。
我的數據包括:
public class RawData
{
public string deviceID { get; set; }
public string timeStamp { get; set; }
public string messageType { get; set; }
public string driverId { get; set; }
public string senosrs { get; set; }
public string startStatus { get; set; }
public string x { get; set; }
public string y { get; set; }
public string course { get; set; }
public string speed { get; set; }
public string satCount { get; set; }
public string signal { get; set; }
public string message { get; set; }
}
我的問題是:
我可以使用的最佳綁定是什么?
我想通過與服務器的連接來回調客戶端。
如何檢查WCF數據包大小?
我使用了本教程:http: //zamd.net/2008/08/15/calculating-wcf-message-size/我的數據包有500長! 是字節還是其他單位?
WCF是否足以應付我們的情況? 我們使用gprs作為DataNetwork。
在這種情況下是否需要實施路由服務?
解決此問題的最佳編碼是什么? 最佳壓縮*速度。
在回答您的問題時:
netTcpBinding-它是性能最高的綁定,因為它基本上是原始套接字。 它還支持雙工 。
如果您需要一次性使用它而不是用於生產監視,請嘗試配置wcf tracing 。 這絕對可以使用該通道記錄每條消息。
均田。 200個並發傳入連接(如果您的服務是無狀態的 ) 非常 容易 (盡管可能需要小規模的擴展 ),但是雙工 wcf充其量是復雜的,而且重要的是擴展性不佳 -您要么為所有客戶端都需要一個服務實例,或者您需要一些持久的后備存儲來同步客戶端回調委托(盡管這可以通過cache有效地實現)。
除非您需要根據消息內容動態更改端點,在網絡協議之間進行轉換等,否則在這種情況下,除了作為一種負載平衡器之外,我看不到用戶需要wcf-routing 。 而且,如果確實需要擴展,則使用實際的網絡負載平衡器可能會更好。
只要通道的兩端均為WCF,netTcpBinding默認就使用二進制編碼。 這是WCF中最優化的綁定。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.