zoukankan      html  css  js  c++  java
  • 研究WCF并发及处理能力的控制

    WCF 跟并发 性能相关的几个配置:
    1、系统控制的客户端网络连接并发(如果服务端也需要并发请求的话这个参数也是需要的):
             <configuration>                <system.net>                        <connectionManagement>                                   <add address="*" maxconnection="1000"/>                          </connectionManagement>                </system.net>         <configuration>         这个参数指定一个进程内(或domain) 并发通信连接个数限制,默认2个(就是系统控制了)
    2、WCF 网络TCP/IP 监听(bingding)控制的传输协议      这个参数是针对某一(些)端点的绑定的控制
                 <bindings>

                    <netTcpBinding>

                            <bindingname="netcpbindingconfig"                 

                                          listenBacklog="100"      maxConnections="100" />

            这2个参数: 第一个就是我们常用的listen的参数,这个意义我们应该很清楚了。

                               第二个参数 msdn解释是: 客户端上可存入池中以备后续重复使用的最大连接数;服务器上可挂起调度的最大连接数。  On the client, the maximum number of connections to be  pooled for subsequent reuse; on the server, the maximum number of  connections allowed to be pending dispatch. (看来中文翻译的不太好)。

                              第一个是tcp协议的控制,第二个是紧跟着协议之后的调度配置(服务端)。

     

          3、针对服务宿主(servicehost)进行的控制

            <serviceBehaviors>

    <behaviorname="MathServiceBehaviours" >

    <serviceThrottling

     

    maxConcurrentCalls="100"

     

    maxConcurrentSessions="100"

     

    maxConcurrentInstances="100"/>

     

    </behavior>

    </serviceBehaviors>

     

         maxConcurrentCalls :该值指定整个 ServiceHost中正在处理的最多消息数。

              specifies the maximum number of messages actively processing across a ServiceHost.

                     

    总结,在服务端控制流量的机制即listenBackLog -> maxConnections -> maxConcurrentCalls(..)

                基本上分三个阶段。也是针对不同的可控制对象。

                listenBackLog 针对tcp连接的缓冲设置

                maxConnections 针对接到连接后,要分配给service消费是 排队(缓冲)的设置;

                maxConcurrentCalls(sessions, instances) 是针对service处理压力的控制。

     

    比较完美了!

  • 相关阅读:
    OC准备知识
    文件操作
    双向链表
    单链表(Single Linked List)
    动态分配内存补充 realloc
    git心得一
    git的工作原理
    git:团队开发的流程
    git操作流程
    js:有关属性
  • 原文地址:https://www.cnblogs.com/gjhjoy/p/3487364.html
Copyright © 2011-2022 走看看