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处理压力的控制。

     

    比较完美了!

  • 相关阅读:
    微信java封装
    解决PowerDesigner 生成Sql2005-2012 找不到sysproperties表的问题
    ASP.net解析JSON例子
    c# 遍历子控件,比如Form下的group,或者panel
    修改sql2005字段
    清除grid内容的列
    sql 2000以及2005以上获取数据库中所有的表(不包括系统表)
    获取SqlServer2005表结构(字段,主键,外键,递增,描述)
    SQL SERVER 数据库实用SQL语句
    查找所有页面中的按钮
  • 原文地址:https://www.cnblogs.com/gjhjoy/p/3487364.html
Copyright © 2011-2022 走看看