ASP.NET, 대용량처리를부탁해-MSE 최준수석컨설턴트
2014년 1월새해명품특강!
ASP.NET, 서비스플랫폼으로날다!
Agenda
소개
IIS 핵심구성요소
ASP.NET Thread Model
대용량처리 – 데이터
대용량처리 – 사용자
질의응답
발표자소개
최 준, [email protected]
경력 Microsoft Korea, Microsoft Singapore (2001 – 2011)
Senior Premier Field Engineer - APAC
Microsoft APAC Team Lead/SME (Internet & Developer Support)
현재
MSE사 수석 컨설턴트
산업체 우수 강사(교육과학기술부)
Microsoft MVP(Most Valuable Professional), IIS/ASP.NET
Quiz – Hello World- Hello.aspx
<%@ Import Namespace="System.Threading" %>
<%
Thread.Sleep(7000)
Response.Write(“Hello")
%>
- World.aspx
<%@ Import Namespace="System.Threading" %>
<%
Thread.Sleep(3000)
Response.Write(“World")
%>
[Quiz]
길동이가 00:00:00시에 Hello.aspx와 World.aspx를거의동시에실행한다면, 언제각각의 ASP.NET페이지에 대한응답을볼수있을까요? (1초이하의시간은반올림하세요.)
Quiz길동이가 00:00:00시에 Hello.aspx와 World.aspx를거의동시에실행한다면, 언제각각의 ASP.NET페이지에대한응답을볼수있을까요?
(1초이하의시간은반올림하세요.)
1번
00:00:03 – World
00:00:07 – Hello
2번
00:00:10 – Hello
00:00:10 – World
3번
00:00:07 – Hello
00:00:10 – World
4번
00:00:03 – World
00:00:10 – Hello
5번
답이없다.
IIS – Internet Information Services
ASP.NET
ASP
IIS
Requests
Responses
IE <> IIS 연결
w3wp.exe
Application
Pool
IIS Core Components HTTP.SYS – Connection/Routing/Response Cache
W3WP – Worker Process
IIS Admin Service
Queue Queue QueueConnection M
anagement
Response Cache
Routing Req
uest
w3wp.exe
Application
Pool
HTTP.SYS
Svchost.exeWWW Service
(w3svc)
w3wp.exe
Application
Pool
How IIS works Inside of W3WP process
IIS core libraries, & Modules
Cache
Handlers
Worker Threads, Free Threads in ThreadPool
ModulesAuthentications
Cache
Tracing
…Handlers (ASP, ASPX)
HTTP.S
YS
Req. Queue
ThreadPool#1WorkerThread
#2WorkerThread
#3WorkerThread
…
#1 Free Thread
#2 Free Thread
…Cache
Output Cache
File Cache
W3
WP.E
XE
How ASP/ASP.NET works Inside of W3WP process
ISAPI Extensions
ASP(asp.dll) ASP.NET (aspnet_isapi.dll)
Worker Threads in ThreadPool
Web Services (*.asmx) - Free Threads in ThreadPool
W3WP
ThreadPools#1WorkerThread – Report.aspx
#2WorkerThread – Login.aspx
#3WorkerThread – Report.aspx
…
#1 Free Thread – LoginCheck.asmx
#2 Free Thread – ReportData.asmx
…
#1 WorkerThread – Login.asp
#2 WorkerThread – Report.asp
…
ASP.NET Thread Parameters IIS6
IIS7, 7.5, 8
http://fullsocrates.wordpress.com, ASP.NET Threads
Machine.config (C:\WINDOWS\Microsoft.NET\Framework\v.x.x.xxx\config)
*.aspx : (MaxWorkerThreads – minFreeThreads) x #CPU = 12 by default
*.asmx : minFreeThreads
Aspnet.config,
C:\Windows\Microsoft.NET\Framework64\v2.0.50727, C:\Windows\Microsoft.NET\Framework64\v4.0.30319
<system.web>
<applicationPool
maxConcurrentRequestsPerCPU="20"
maxConcurrentThreadsPerCPU="20"
requestQueueLimit="5000"/>
</system.web>
시연 – 부하테스트 1CPU, IIS6 Server
ASP.NET – 20sec/page<%@ Import Namespace="System.Threading" %>
<%
Thread.Sleep(20000)
Response.Write("Hello")
%>
서버사용량많음
대용량처리 - 데이터
Garbage Collector - .NET Memory Manager
GC
.NET Memory Manager
Win32 Heap Manager vs GC in .NET
1GC Thread per CPU
GC Sequence
Gen 0Gen 1
MarkSweepCompact
Gen 2
31 2 5 6 7 98 104 11 12 13 14 15 16
GC에의한성능문제 GC 작업에의한요청지연
A – B – C – B – A
A – B – GC – C – GC – B – A
GC 성능문제원인오래사는 Object
옮길수없는 Object
많은 Object
큰 Object
GC 성능향상의방향성 .NET Object + 지역변수사용
작은 Object 사용
Using 문, 또는 Dispose Method 구현 Native(Win32) Resource
http://support.microsoft.com/kb/937214
64bit Windows + IIS + ASP.NET
Scalable Service Design
IIS & ASP.NET Scalability
IIS Servers
W3WP – Worker Processes (Application Pools)
확장성의주요장애요소 Session Object
In Process, StateServer, SQLServer
Multi-Thread SafetyXMLHTTP, VB STA Component, DB Library
Blocking shared resource File IO, DB Connections
Cache Options ASP.NET
Session
Application Cache
Output Cache
IIS Cache
File Cache, Response Cache
Compiled Binary – Template Cache
Client Cache
Browser Cache
성능최적화 안정성문제 > 성능문제
Crash (Unhanded Exception)
시스템자원분석
모니터 > 분석/평가 > [baseline] > 모니터 < [성능병목임계값]
CPU, Memory, Disk, Network – 성능모니터
Memory
Kernel Memory – Paged Pool, Non-paged Pool, PTE…
User-mode Virtual Memory – Process\Private Bytes
RAM
CPU
%Processor Time, %Privileged Time, %Time in GC…
References Microsoft Official IIS web site
www.iis.net
Microsoft Official ASP.NET web site www.asp.net
Blog : IIS Core Components, ASP.NET Threads http://fullsocrates.wordpress.com
IIS, ASP.NET 교육과정 http://www.mse.ne.kr
웹서버보안관리국제표준 ASP, ASP.NET 웹서버의테스트와 성능최적화 IIS Migration Steps