2011-10-16 3 views
1

단일 IIS7 응용 프로그램 서버에서 호스팅되는 WCF wsHttp 서비스를 호출하는 두 대의 서버에서 웹 사이트로드 균형을 조정했습니다.WCF 메시지 보안 - PerCall

지난 주 웹 사이트가 개설되어 성능 문제가 발생했습니다.

시스템은 근해 팀에 의해 지어졌지만 도움이 될지 조사하기 위해 요청되었습니다.

나는 현재 세션을 보려면 perfmon을로드하고 asp.net 카운터를 사용했습니다. 나는 이것이 약 25 이상으로 증가하면 웹 사이트가 크게 둔화되었음을 알 수있었습니다. 다음 10 분 동안 약 250으로 계속 증가 할 것이며, 그 다음 0으로 떨어지고 사이트 성능은 좋아질 것입니다.

주기적으로 계속됩니다 - 나쁜 소식입니다!

다음날, 근해 팀은 보안을 조정하여 문제를 해결했다고 알려 줬습니다.

wsHttp 바인딩 WCF의 보안을 비활성화하면 세션 당 인스턴스 생성에서 호출 당 인스턴스 생성으로 변경된다는 이론이 있습니다. 따라서 서비스 요청 처리량이 훨씬 더 많습니다. 이것은 좋은 이론입니까?

이 테스트를 위해 간단한 모델을 만들었습니다. IIS에서 호스팅되는 몇 가지 방법과 여러 요청을 생성하는 간단한 클라이언트가 있습니다. 이것은 내가 기대했던 결과를주는 것처럼 보입니다. 문제는 보안 바인딩을 사용하지 않을 때 더 적은 수의 요청이 대기열에 추가되고 더 많은 동시 인스턴스가 생성되었음을 증명하기 위해 올바른 성능 모니터 카운터를 찾기 위해 고심하고 있습니다.

누구나 사용할 수있는 최고의 성능 카운터에 대한 조언을 구할 수 있습니까?

확인을 클릭하고 더 많은 질문을드립니다. 내 테스트 응용 프로그램에서

, 지금

  • 메시지 보안
  • 메시지 보안하지만 3 가지 wsHttp 바인딩

    1. 보안없이 3 개 서비스 클래스가 [인 ServiceBehavior (InstanceContextMode = InstanceContextMode.PerCall)] 클래스에 설정

    클라이언트에서 40 루프 내에서 새 스레드를 시작하고 서비스를 호출합니다. 서비스 1을 호출하면 서비스는 1 초 이내에 모든 요청을 완료합니다.

    서비스 2를 호출하면 서비스가 33 초 내에 모든 요청을 완료합니다.

    서비스 3을 호출하면 서비스가 4 개의 호출마다 새 서비스 객체를 인스턴스화 할 것으로 예상하므로 서비스 1만큼 빠름을 기대합니다. 그러나이 작업을 수행하는 데는 (나는 여전히 의미있는 성능 모니터 카운터가 없습니다!) 보이지 않으며 총 완료 시간도 33 초입니다. 여기

    는 서비스의 설정입니다 :

    <?xml version="1.0"?> 
    <configuration> 
        <system.diagnostics> 
        <sources> 
         <source name="System.ServiceModel" 
           switchValue="Information, ActivityTracing" 
           propagateActivity="true" > 
         <listeners> 
          <add name="traceListener" 
           type="System.Diagnostics.XmlWriterTraceListener" 
           initializeData="c:\WCFTrace\InstancingDemo.svclog" /> 
         </listeners> 
         </source> 
        </sources> 
        </system.diagnostics> 
        <system.serviceModel> 
        <behaviors> 
         <serviceBehaviors> 
         <behavior name="SecPerCallBehaviour"> 
          <serviceThrottling maxConcurrentSessions="1000" 
               maxConcurrentCalls="30" 
               maxConcurrentInstances="30"/> 
          <serviceMetadata httpGetEnabled="true" /> 
          <serviceDebug includeExceptionDetailInFaults="false" /> 
         </behavior> 
         <behavior name=""> 
          <serviceMetadata httpGetEnabled="true" /> 
          <serviceDebug includeExceptionDetailInFaults="false" /> 
         </behavior> 
         </serviceBehaviors> 
        </behaviors> 
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
        <bindings> 
         <wsHttpBinding> 
         <binding name="BindingNoSec"> 
          <security mode="None" /> 
         </binding> 
         <binding name="BindingMessageSec"> 
          <security mode="Message"> 
          <message establishSecurityContext ="true"/> 
          </security> 
         </binding> 
         <binding name="BindingMessageSecPerCall" > 
          <security mode="Message"> 
          <message establishSecurityContext ="true"/> 
          </security> 
         </binding> 
         </wsHttpBinding> 
        </bindings> 
        <services> 
         <service name="ServiceInstancingDemo.Service1"> 
         <endpoint address="~/Service1.svc" 
          binding="wsHttpBinding" bindingConfiguration="BindingNoSec" 
          name="NoSecurity" contract="ServiceInstancingDemo.IService1" /> 
         </service> 
         <service name="ServiceInstancingDemo.Service2"> 
         <endpoint address="~/Service2.svc" 
          binding="wsHttpBinding" bindingConfiguration="BindingMessageSec" 
          contract="ServiceInstancingDemo.IService2" /> 
         </service> 
         <service name="ServiceInstancingDemo.Service3" behaviorConfiguration="SecPerCallBehaviour"> 
         <endpoint address="~/Service3.svc" 
          binding="wsHttpBinding" bindingConfiguration="BindingMessageSecPerCall" 
          contract="ServiceInstancingDemo.IService3" /> 
         </service> 
        </services> 
        </system.serviceModel> 
    </configuration> 
    

    그리고 여기에 클라이언트의 설정입니다 :

    <?xml version="1.0" encoding="utf-8" ?> 
    <configuration> 
        <system.serviceModel> 
         <bindings> 
          <wsHttpBinding> 
           <binding name="WSHttpBinding_IService2" closeTimeout="00:01:00" 
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
            allowCookies="false"> 
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
             maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
            <reliableSession ordered="true" inactivityTimeout="00:10:00" 
             enabled="false" /> 
            <security mode="Message"> 
             <transport clientCredentialType="Windows" proxyCredentialType="None" 
              realm="" /> 
             <message clientCredentialType="Windows" negotiateServiceCredential="true" 
              algorithmSuite="Default" establishSecurityContext="true" /> 
            </security> 
           </binding> 
           <binding name="NoSecurity" closeTimeout="00:01:00" openTimeout="00:01:00" 
            receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" 
            transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
            allowCookies="false"> 
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
             maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
            <reliableSession ordered="true" inactivityTimeout="00:10:00" 
             enabled="false" /> 
            <security mode="None"> 
             <transport clientCredentialType="Windows" proxyCredentialType="None" 
              realm="" /> 
             <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 
            </security> 
           </binding> 
           <binding name="WSHttpBinding_IService3" closeTimeout="00:01:00" 
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" 
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
            allowCookies="false"> 
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
             maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
            <reliableSession ordered="true" inactivityTimeout="00:10:00" 
             enabled="false" /> 
            <security mode="Message"> 
             <transport clientCredentialType="Windows" proxyCredentialType="None" 
              realm="" /> 
             <message clientCredentialType="Windows" negotiateServiceCredential="true" 
              algorithmSuite="Default" /> 
            </security> 
           </binding> 
          </wsHttpBinding> 
         </bindings> 
         <client> 
          <endpoint address="http://rb-t510/NGCInstancing/Service2.svc/~/Service2.svc" 
           binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService2" 
           contract="NGCWithSec.IService2" name="WSHttpBinding_IService2"> 
           <identity> 
            <servicePrincipalName value="host/RB-T510" /> 
           </identity> 
          </endpoint> 
          <endpoint address="http://rb-t510/NGCInstancing/Service1.svc/~/Service1.svc" 
           binding="wsHttpBinding" bindingConfiguration="NoSecurity" 
           contract="NGC.IService1" name="NoSecurity" /> 
          <endpoint address="http://localhost/NGCInstancing/Service3.svc/~/Service3.svc" 
           binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService3" 
           contract="NGCSecPerCall.IService3" name="WSHttpBinding_IService3"> 
           <identity> 
            <servicePrincipalName value="host/RB-T510" /> 
           </identity> 
          </endpoint> 
         </client> 
        </system.serviceModel> 
    </configuration> 
    

    내가이 구성 설정을 누락 추측?또는 wsHttp를 통한 메시지 보안을 사용하는 다중 호출은 세션 당 인스턴스화되어야하고 각 클라이언트에 대해 단일 세션 만 생성되기 때문에 항상 매우 느립니다.

    많은 감사합니다.

    Rob. 당신이 원하는

  • 답변

    1

    카운터는 명시 적으로 서비스를 사용할 수 있습니다

    <configuration> 
        <system.serviceModel> 
         <diagnostics performanceCounters="All" /> 
        </system.serviceModel> 
    </configuration> 
    

    분명히 너무 더 세분화 할 수있다. WCF Performance Counters

    업데이트 : 더 나은 링크 : How to use performance counters to diagnose performance of WCF applications

    +0

    안녕, 나는 이미 WCF의 설정에 카운터를 활성화를 이것은 당신이 읽고 싶은 것입니다. 문제는 perfmon에서 사용할 수있는 카운터 중 하나도 필요하지 않은 정보 (예 : 생성 된 인스턴스 수)를 제공하지 않는 것입니다. –

    +0

    어니, 도움이되는 링크입니다 - 고마워요. –

    +0

    perfmon 선택 : ServiceModelService 4.0.0.0 -> 인스턴스 -><모든 인스턴스>. 확인을 클릭하십시오. 이제 "인스턴스"목록에서 서비스를 찾으십시오. – ErnieL

    관련 문제