简体   繁体   English

如何增加最大连接数WCF NET TCP

[英]How to increase Max connections WCF NET TCP

I'm setting the WCF NET TCP server. 我正在设置WCF NET TCP服务器。 So far I'm going good with few connections. 到目前为止,我的连接很少,一切都很好。 But since I've decided to do some stress testing, I've found some problems. 但是,由于我决定进行一些压力测试,因此发现了一些问题。 With a client starting threads, I get 128 successful connections, but at the 129th connections, I get: 在客户端启动线程的情况下,我获得了128个成功的连接,但是在第129个连接中,我得到了:

too busy servers exception. 服务器太忙异常。

I've already changed maxConnections to 1000 at the binding. 我已经在绑定处将maxConnections更改为1000。 I've already changed maxConcurrentCalls, maxConcurrentSessions, maxConcurrentInstances to 5000 (testing only) at serviceThrottling. 我已经在serviceThrottling上将maxConcurrentCalls,maxConcurrentSessions,maxConcurrentInstances更改为5000(仅测试)。

My Binding: 我的绑定:

<binding name="netTcpClientsBindingConfig" transferMode="Buffered" maxReceivedMessageSize="50242880"
    closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00"
    sendTimeout="00:05:00" maxConnections="1000">

My Behavior config: 我的行为配置:

<behavior name="mexClientsBehavior">
    <serviceThrottling
        maxConcurrentCalls     = "5000"
        maxConcurrentSessions  = "5000"
        maxConcurrentInstances = "5000"
    />

I'm expecting to accept at least 1000 connections. 我希望至少接受1000个连接。

There is one limitation here (I believe so! Please can anyone correct me if there is another solution): 这里有一个限制(我相信是这样!如果还有其他解决方案,请任何人纠正我):

I need to retain the connection OPENED, because my server may contact the client through callbacks to send information that the clients should know about as soon as possible. 我需要保持连接已打开,因为我的服务器可能通过回调与客户端联系,以发送客户端应尽快了解的信息。 If the connection is closed, I cannot re-open at the server side, or can I? 如果连接已关闭,则无法在服务器端重新打开,或者可以吗? That would be a solution. 那将是一个解决方案。

My problem was: I was using the app.config to create the WCF TCP service. 我的问题是:我正在使用app.config创建WCF TCP服务。

I've created everything again, but programmatically! 我已经重新创建了所有内容,但是是以编程方式创建的! Now my software has the max connections and all the Throttling needed configs. 现在,我的软件具有最大连接数和所有节流所需的配置。 Also, now I can create the endpoints dinamically! 另外,现在我可以动态创建端点了! That's a way to deploy services (windows service based) in multiple computers to load balance. 这是一种在多台计算机上部署服务(基于Windows服务)以实现负载平衡的方法。

I'm using VS 2017 15.9.11 Hope that anyone else that pass trough this king of problem get this answer. 我正在使用VS 2017 15.9.11,希望通过此问题之王的其他任何人都能得到此答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM