Maystyle :
Admin : New post
Guestbook
Local
media
Catergories
Recent Articles
Recent Comments
Recent Trackbacks
Calendar
Tag
Archive
Link
Search
 
  ASP.net 튜닝 (Machine.config, Web.config 수정) 
작성일시 : 2008. 8. 6. 02:33 | 분류 : Windows Server/IIS

주의 : 아래 내용은 .net framework 1.x 를 기준으로 구성되었다.
설정 변경에 있어 주의가 요구 된다.

ASP.Net는 IIS의 요청을 Aspnet_wp.exe 프로세스가 처리한다.
즉 일반 IIS와는 달리 설정 파라메터가 전역 설정인 Machine.config 및 어플리케이션 설정인 Web.config에 저장된다. 다음은 Machine.config 및 Web.config 설정에 대한 설명이다.

구성 파라메터 설명

- maxWorkerThreads 및 maxIoThreads

ASP.NET은 사용되는 작업자 스레드와 완료 스레드의 최대 수를 제한하기 위한 설정이다.
<processModel maxWorkerThreads="20" maxIoThreads="20">
maxWorkerThreads 매개 변수와 maxIoThreads 매개 변수는 암시적으로 CPU 수를 곱한 값으로 예를 들어, 두 프로세서가 있는 경우 작업자 스레드의 최대 수는 2*maxWorkerThreads 와 같다.

- minFreeThreads 및 minLocalRequestFreeThreads

ASP.NET에는 원격 요청이나 로컬 요청을 시작하는 데 사용할 수 있는 작업자 스레드와 완료 포트 스레드 수를 결정하는 다음 구성 설정도 포함되어 있다.
<httpRuntime minFreeThreads="8" minLocalRequestFreeThreads="8">
사용 가능한 스레드가 충분하지 않은 경우 요청은 충분한 스레드를 요청에 사용할 수 있을 때까지 대기열에 저장된다. 따라서 ASP.NET은 동시에 (maxWorkerThreads*number of CPUs)-minFreeThreads 이상의 요청을 실행하지 못한다.
참고 : minFreeThreads 매개 변수와 minLocalRequestFreeThreads 매개 변수를 암시적으로 CPU 수로 곱하지 않는다.

- minWorkerThreads

ASP.NET 1.0 서비스 팩 3 및 ASP.NET 1.1부터 ASP.NET에는 원격 요청에 즉시 사용할 수 있는 작업자 스레드 수를 결정하는 다음 구성 설정이 포함되었다.
<processModel minWorkerThreads="1">
이 설정을 통해 제어되는 스레드는 CLR의 기본 "스레드 조정" 기능으로 만드는 작업자 스레드보다 훨씬 빠른 속도로 만들 수 있게 되었다. 이 설정을 사용하면 백 엔드 서버의 속도 저하, 클라이언트측으로부터의 갑작스런 요청 쇄도 또는 대기열의 요청 수를 급격히 증가시키는 것과 비슷한 원인으로 인해 ASP.NET 요청 대기열을 갑자기 채우라는 요청을 처리할 수 있다. minWorkerThreads 매개 변수의 기본값은 1이다. minWorkerThreads 매개 변수의 값을 . minWorkerThreads = maxWorkerThreads / 2 으로 설정하여 주는 것이 좋다.

기본적으로 minWorkerThreads 매개 변수는 Web.config 파일이나 Machine.config 파일에 모두 표시되지 않는다. 이 설정은 암시적으로 CPU 수를 곱한 값이다.

- maxconnection

maxconnection 매개 변수를 사용하면 특정 IP 주소에 만들 수 있는 연결 수를 결정할 수 있다.
<connectionManagement>
<add address="*" maxconnection="2">
<add address="65.53.32.230" maxconnection="12">
</connectionManagement>

이 문서 앞부분에서 설명한 매개 변수에 대한 설정은 모두 프로세스 수준이였다. 그러나 maxconnection 매개 변수 설정은 AppDomain 수준에 적용된다. 기본적으로 이 설정은 AppDomain 수준에 적용되므로 프로세스의 각 AppDomain에서 특정 IP 주소에 대한 연결을 최대 두 개까지 만들 수 있다.

- executionTimeout

ASP.NET은 다음 구성 설정을 사용하여 요청 실행 시간을 제한한다.
<httpRuntime executionTimeout="90"/>
Server.ScriptTimeout 속성을 사용하여 이 제한을 설정할 수도 있다.
참고 : executionTimeout 매개 변수의 값을 늘리는 경우 processModel responseDeadlockInterval 매개 변수 설정을 수정해야 할 수 도 있다.

권장 사항

각 ASPX 페이지에서 한 IP 주소에 대한 웹 서비스를 호출하는 경우 다음 구성 설정을 사용하는 것이 좋다.

- maxWorkerThreads 매개 변수와 maxIoThreads 매개 변수의 값을 100으로 설정
- maxconnection 매개 변수의 값을 12*N(CPU 수)으로 설정한다.
- minFreeThreads 매개 변수의 값을 88*N(CPU 수)으로, minLocalRequestFreeThreads 매개 변수의 값을 76*N으로 설정한다.
- minWorkerThreads 매개 변수의 값을 50으로 설정한다. 기본적으로 minWorkerThreads는 구성 파일에 없으므로 직접 추가해야 한다.

Configuration setting

Default (.NET 1.1)

Recommended value

maxconnection

2

12 * #CPUs

maxIoThreads

20

100

maxWorkerThreads

20

100

minFreeThreads

8

88 * #CPUs

minLocalRequestFreeThreads

4

76 * #CPUs

위의 계산식에서 하이퍼 스레딩을 활성화하는 경우 물리적 CPU 수가 아닌 논리적 CPU 수를 사용해야 한다. 예를 들어, 하이퍼 스레딩이 활성화된 네 개의 프로세서로 구성된 서버가 있는 경우, 이 공식의 N4가 아닌 8이 된다. 즉 이 경우 100 – 88 = 12 즉 CPU당 최대 12개의 ASP.NET 요청을 실행 할 수 있따. 따라서 최소 최소 88*N개의 작업자 스레드와 88*N개의 완료 포트 스레드를 다른 용도(예: 웹 서비스 콜백용)로 사용할 수 있다.

예를 들어 하이터 쓰레딩이 활성화된 4CPU의 서버의 경우 아래와 같은 설정값을 사용하면 된다.
<processModel maxWorkerThreads="100" maxIoThreads="100" minWorkerThreads="50"> <httpRuntime minFreeThreads="704" minLocalRequestFreeThreads="608"> <connectionManagement> <add address="[ProvideIPHere]" maxconnection="96"/> </connectionManagement>

병목 검출을 위한 성능 카운터

Area

Counter

Worker Process

ASP.NET\Worker Process Restarts

Throughput

ASP.NET Applications\Requests/Sec
Web Service\ISAPI Extension Requests/sec
Requests: ASP.NET\ Requests Current
ASP.NET Applications\Requests Executing
ASP.NET Applications\ Requests Timed Out

Response time / latency

ASP.NET\ Request Execution Time

Cache

ASP.NET Applications\ Cache Total Entries
ASP.NET Applications\ Cache Total Hit Ratio
ASP.NET Applications\Cache Total Turnover Rate
ASP.NET Applications\Cache API Hit Ratio
ASP.NET Applications\ Cache API Turnover Rate
ASP.NET Applications\ Output Cache Entries
ASP.NET Applications\ Output Cache Hit Ratio
ASP.NET Applications\ Output Cache Turnover Rate

출처
http://support.microsoft.com/kb/821268/ko
http://msdn.microsoft.com/en-us/library/ms998583.aspx

|