응용 프로그램의 메모리 부족 현상이 발생하지 않도록 다양한 처리량 설정을 제어


하려면 ServiceThrottlingBehavior 클래스를 사용합니다.

MaxConcurrentCalls 속성은 ServiceHost에서 현재 처리되는 메시지 수를 제한합니다.

MaxConcurrentInstances 속성은 ServiceHost에서 한 번에 실행하는 InstanceContext 개체 수를 제한합니다.

MaxConcurrentSessions 속성은 ServiceHost 개체에서 수락할 수 있는 세션 수를 제한합니다.

런타임 부하 분산 기능을 사용하려면 응용 프로그램 실행 경험이 필요하므로, 응용 프로그램 구성 파일을 통해 ServiceThrottlingBehavior를 사용하는 것이 서비스 성능을 극대화하도록 실행을 수정하는 가장 일반적인 방법입니다

image

 

<configuration>
  <appSettings>
    <!-- use appSetting to configure base address provided by host -->
    <add key="baseAddress" value="http://localhost:8080/ServiceMetadata" />
  </appSettings>
  <system.serviceModel>
    <services>
      <service 
        name="Microsoft.WCF.Documentation.SampleService"
        behaviorConfiguration="Throttled" >
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/SampleService"/>
          </baseAddresses>
        </host>
        <endpoint
          address=""
          binding="wsHttpBinding"
          contract="Microsoft.WCF.Documentation.ISampleService"
         />
        <endpoint
          address="mex"
          binding="mexHttpBinding"
          contract="IMetadataExchange"
         />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior  name="Throttled">
          <serviceThrottling 
            maxConcurrentCalls="1" 
            maxConcurrentSessions="1" 
            maxConcurrentInstances="1"
          />
          <serviceMetadata 
            httpGetEnabled="true" 
            httpGetUrl=""
          />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>

+ Recent posts