WCF提高性能并停止阻止

时间:2012-07-16 14:27:02

标签: c# wcf

我有一个客户端 - 服务器应用程序,可以将服务器的市场数据传递给客户端。 现在我已经遇到了两个问题: 1.回调性能差。我每秒最多可以获得1.5K的回调 2.当一个客户端开始“卡住”时 - 所有用户开始慢慢地检索数据(每秒200次回调)。 这是我的服务器绑定:

<netTcpBinding>
<binding name="Net_Tcp_Binding" receiveTimeout="10:00:00" sendTimeout="00:00:30"
  maxConnections="100">
 <readerQuotas maxArrayLength="2147483647" />
 <security mode="None" />
</binding>
   </netTcpBinding>

和服务合同(95%的数据使用MarketDepthUpdate和EntityUpdate提供):

namespace TradePlatform.DataDeliveryContracts.ServiceContracts

public interface ITradeServiceCallback
{
    [OperationContract(IsOneWay = true)]
    void InstrumentUpdate(InstrumentInfo instrument);

    [OperationContract(IsOneWay = true)]
    void OrderUpdate(OrderInfo order);

    [OperationContract(IsOneWay = true)]
    void OrderFailedUpdate(OrderFailInfo orderFailed);

    [OperationContract(IsOneWay = true)]
    void MyTradeUpdate(MyTradeInfo myTrade);

    [OperationContract(IsOneWay = true)]
    void TradeUpdate(TradeInfo trade);

    [OperationContract(IsOneWay = true)]
    void PortfolioUpdate(DSPortfolioInfo portfolio);

    [OperationContract(IsOneWay = true)]
    void PositionUpdate(PositionInfo position);

    [OperationContract(IsOneWay = true)]
    void MarketDepthUpdate(MarketDepthShortInfo marketDepth);

    [OperationContract(IsOneWay = true)]
    void DisconnectUser();

    [OperationContract(IsOneWay = true)]
    void UserUpdate(UserInfo user);

    [OperationContract(IsOneWay = true)]
    void FileUpdate(FileDataInfo file);

    [OperationContract(IsOneWay = true)]
    void SimulationDataUpdate(SimulationModeData simulationData);

    [OperationContract(IsOneWay = true)]
    void MessageUpdate(MessageId message, params object[] parameters);

    [OperationContract(IsOneWay = true)]
    void EntityUpdate(DataUpdateInfo updateInfo);

    [OperationContract(IsOneWay = true)]
    void Ping();


}

这是客户:

NetTcpBinding binding = new NetTcpBinding
        {
            Security = { Mode = SecurityMode.None },
            MaxReceivedMessageSize = 2147483647
        };
        binding.ReaderQuotas = new XmlDictionaryReaderQuotas();
        binding.ReaderQuotas.MaxArrayLength = 2147483647;
        binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
        binding.SendTimeout = new TimeSpan(0, 10, 0);

0 个答案:

没有答案