Upload
pratik
View
299
Download
0
Embed Size (px)
Citation preview
Introduction To WebIntroduction To WebIntroduction To Web Introduction To Web Application ArchitectureApplication Architecturepppp
PRATIK PRATIK GohilGohilSr Lecturer SVICSSr Lecturer SVICS KadiKadiSr. Lecturer, SVICS, Sr. Lecturer, SVICS, [email protected]@gmail.comResources: p2gohil.blogspot.comResources: p2gohil.blogspot.com
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
AgendaAgendaIIS 6.0 and IIS 6.0 and ASP.NetASP.Net ArchitectureArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
AgendaAgendaIIS 6.0 and IIS 6.0 and ASP.NetASP.Net ArchitectureArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Rearchitecting IISRearchitecting IISA review of IIS5A review of IIS5
DLLHost.EXE
ISAPIDLLHost.EXEINETINFO.EXE
ExtensionsISAPI
Extensions
ISAPI Filters and Extensions DLLHost.EXE
ISAPI
WinSock 2 0
Metabase ISAPIExtensions
TCP/IPkernel
user WinSock 2.0
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
TCP/IP
IIS 6.0 ArchitectureIIS 6.0 Architecture
Goal: Enable complete appGoal: Enable complete appGoal: Enable complete app Goal: Enable complete app isolation from other Web isolation from other Web apps and core Web serverapps and core Web serverWeb service in INETINFOWeb service in INETINFO
WASWASW3wp.exeW3wp.exeW3wp.exeW3wp.exeW3wp.exeW3wp.exe
web web appapp
Web service in INETINFO Web service in INETINFO split out to do this:split out to do this:
Http.sys: Kernel mode Http.sys: Kernel mode li t d t tli t d t t
web web appapp
web web appappWeb Web
AppApplistener and request routerlistener and request routerWAS: Config and process WAS: Config and process managermanagerW3 Wh W bW3 Wh W b HttHttelel
AppApp
W3wp.exe: Where Web apps W3wp.exe: Where Web apps are processedare processed
Multiple W3wp.exe filesMultiple W3wp.exe files
Http.sysHttp.sysK
ern
Ker
n
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Process Model ContrastProcess Model ContrastIIS5 to IIS6 IIS5 to IIS6 –– Making it more robustMaking it more robust
Worker Worker ProcessProcess
Worker Worker ProcessProcess
Worker Worker ProcessProcess
INETINFOINETINFO
AppPool 1AppPool 1 AppPool 2AppPool 2
RequestsRequestsApp2App2
ProcessProcess
App2App2
ProcessProcess
App1App1
ProcessProcess
WASWASmetabasemetabase
User Mode
Kernel Mode
FiltersFiltersFiltersFiltersFiltersFilters
HTTP.SYSHTTP.SYS TCP/IP TCP/IP ConnectionsConnections
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
ASP.Net on IIS 6ASP.Net on IIS 6NET Application Domains vs Application PoolsNET Application Domains vs Application Pools.NET Application Domains vs. Application Pools.NET Application Domains vs. Application Pools
Application domainsApplication domainsApplication PoolApplication PoolLightweight CLR unit of isolationLightweight CLR unit of isolation
One app domain per IIS applicationOne app domain per IIS applicationCombine with W3wp.exe files to Combine with W3wp.exe files to achie e high scalabilit and isolationachie e high scalabilit and isolation
W3wp.exeW3wp.exe
ASP NETASP NET
Application PoolApplication Pool
achieve high scalability and isolationachieve high scalability and isolationASP.NET manages app domains ASP.NET manages app domains independentlyindependently
Recycled within a single processRecycled within a single process
ASP.NETASP.NET
AppAppAppAppRecycled within a single processRecycled within a single process
Can have private components, Can have private components, session variables , etc.session variables , etc.
App poolApp pool
DomainDomainAppApp
DomainDomainAppApp
DomainDomainAppApp
DomainDomainAppApp
DomainDomainAppApp
DomainDomainAppApp
DomainDomainAppAppApp poolApp pool
W3wp.exeW3wp.exe
ASP.NETASP.NETWASWAS
DomainDomainDomainDomainW3wp.exeW3wp.exe
ASP.NETASP.NET
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Http.sysHttp.sys
AgendaAgendaIIS 6.0 and ASP.Net ArchitectureIIS 6.0 and ASP.Net ArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Application PoolsApplication PoolsApplication Isolation in ProcessesApplication Isolation in Processes
Can create 1 or moreCan create 1 or moreCan create 1 or more Can create 1 or more application poolsapplication pools
Each served by 1 or Each served by 1 or more processesmore processesmore processes.more processes.Each worker process Each worker process serves only 1 pool.serves only 1 pool.Reqs routed directly toReqs routed directly toReqs routed directly to Reqs routed directly to pool by HTTP.syspool by HTTP.sys
Isolate apps based Isolate apps based on:on:
Site/CustomerSite/CustomerFunctionalityFunctionality
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
FunctionalityFunctionalityReliabilityReliability
RecyclingRecyclingy gy gWhat is it and Why use it?What is it and Why use it?
What is it?What is it?What is it?What is it?Periodically restart Periodically restart applications based on:applications based on:
UptimeUptimeUptimeUptime# of requests# of requestsScheduled timeScheduled timeMemory consumptionMemory consumptiony py pOnOn--demanddemand
Why use it?Why use it?Refresh apps to ensureRefresh apps to ensureRefresh apps to ensure Refresh apps to ensure availabilityavailabilityPrevent bad apps from Prevent bad apps from taking over the systemtaking over the system
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
No interruption in No interruption in Service!!Service!!
RecyclingRecyclingOverlapping RecycleOverlapping Recycle
startupstartupreadyready
Old Worker Old Worker ProcessProcess
New Worker New Worker ProcessProcess
WAS
WAS
ProcessProcess
Web Proc. Web Proc. Core DLLCore DLL
Ready for Ready for RecycleRecycle
ProcessProcess
Web Proc. Web Proc. Core DLLCore DLL
Shut downShut down
user
ISAPI Exts &ISAPI Exts &FiltersFilters
ISAPI Exts &ISAPI Exts &FiltersFilters
kernelHTTP.SYSHTTP.SYS
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.RequestRequestRequestRequest
AgendaAgendaIIS 6.0 and ASP.Net ArchitectureIIS 6.0 and ASP.Net ArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Increasing .NET Scale & PerformanceIncreasing .NET Scale & PerformanceAttributes of Scalable Web ApplicationsAttributes of Scalable Web ApplicationsAttributes of Scalable Web ApplicationsAttributes of Scalable Web Applications
StatelessStatelessStatelessStatelessApplication code and components can be Application code and components can be restarted cheaply; session state is restarted cheaply; session state is p y;p y;managed externally in some sort of state managed externally in some sort of state storestore
Low initialization costsLow initialization costsApplications should avoid doing heavyApplications should avoid doing heavyApplications should avoid doing heavy Applications should avoid doing heavy processing at startup or assume that they processing at startup or assume that they will run for a long timewill run for a long time
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Increasing .NET Scale & PerformanceIncreasing .NET Scale & PerformanceAttributes of Scalable Web ApplicationsAttributes of Scalable Web Applications (2)(2)Attributes of Scalable Web ApplicationsAttributes of Scalable Web Applications (2)(2)
Can have multiple instancesCan have multiple instancesCan have multiple instancesCan have multiple instancesAll the components and classes of an All the components and classes of an application should be able to have multiple application should be able to have multiple pp ppp pinstances in separate processes without instances in separate processes without namespace or locking issuesnamespace or locking issues
Expect administratorExpect administrator--imposed limitsimposed limitsYour application is likely to haveYour application is likely to haveYour application is likely to haveYour application is likely to have
CPU limitsCPU limitsMemory limitsMemory limitsProcessor affinity imposedProcessor affinity imposed
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Processor affinity imposedProcessor affinity imposed
Making Applications More ReliableMaking Applications More ReliableWeb Farm Session StateWeb Farm Session StateWeb Farm Session StateWeb Farm Session State
Session state can be stored in an externalSession state can be stored in an externalSession state can be stored in an external Session state can be stored in an external processprocess
ASPState Service ASPState Service MicrosoftMicrosoft®® SQL ServerSQL Server™™ 20002000
Big reliability wins Big reliability wins Session state survives crashes/restartsSession state survives crashes/restarts
Enables Web farm deploymentEnables Web farm deploymentS i t t b h d W bS i t t b h d W bSession state can now be shared across a Web Session state can now be shared across a Web farm of ASP.NET serversfarm of ASP.NET serversApplications no longer tied to one computerApplications no longer tied to one computer
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Design your apps to be recycled!Design your apps to be recycled!
AgendaAgendaIIS 6.0 and ASP.Net ArchitectureIIS 6.0 and ASP.Net ArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Dynamic Kernel CachingDynamic Kernel CachingWithWithWithoutWithout
CacheCache
WithWithCacheCache
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
RequestRequest ResponseResponse RequestRequest ResponseResponse
ASP.Net 2.0 Caching ImprovementsASP.Net 2.0 Caching ImprovementsData CachingData CachingData CachingData Caching
DataData--set based dataset based data--sources can be sources can be easily cachedeasily cached
Just set Just set EnableCachingEnableCaching to true on datato true on data--t lt lsource controlsource control
Also set Also set CacheDurationCacheDuration, , CacheExpirationPolicyCacheExpirationPolicy
SQL C h I lid ti f St l D tSQL C h I lid ti f St l D tSQL Cache Invalidation for Stale DataSQL Cache Invalidation for Stale DataSQL 7, 2000 use a custom change table, a SQL 7, 2000 use a custom change table, a DB trigger and a polling mechanism byDB trigger and a polling mechanism byDB trigger and a polling mechanism by DB trigger and a polling mechanism by ASP.NetASP.NetSQL 2005 uses Service BrokerSQL 2005 uses Service Broker
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
SQL 2005 uses Service BrokerSQL 2005 uses Service Broker
ASP.Net 2.0 Caching ImprovementsASP.Net 2.0 Caching ImprovementsPostPost Cache SubstituionCache SubstituionPostPost--Cache Substituion Cache Substituion
Output Cache an entire page except XXXOutput Cache an entire page except XXXXXX must be a simple stringXXX must be a simple string
Use Response.WriteSubstitution with Use Response.WriteSubstitution with callbackcallbackcallbackcallback
Or Use Substitution Control with Or Use Substitution Control with associated Callback methodassociated Callback method
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
AgendaAgendaIIS 6.0 and ASP.Net ArchitectureIIS 6.0 and ASP.Net ArchitectureReliabilityReliabilityState ManagementState ManagementState ManagementState ManagementCachingCachingOth C l St ffOth C l St ffOther Cool StuffOther Cool Stuff
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Resource Optimization in IIS 6Resource Optimization in IIS 6Idle Timeout and Demand StartIdle Timeout and Demand StartIdle Timeout and Demand StartIdle Timeout and Demand Start
Idle timeoutIdle timeoutTimeout and shutdown idle processes if process isTimeout and shutdown idle processes if process isTimeout and shutdown idle processes if process is Timeout and shutdown idle processes if process is idle for given period of time.idle for given period of time.Frees resources for active applications.Frees resources for active applications.A till il bl if k idlA till il bl if k idlApps still available even if worker process idles Apps still available even if worker process idles out and is shut down! out and is shut down!
Demand startDemand startOnly start worker process if there is demand for Only start worker process if there is demand for the application pool. the application pool.
Application considerationsApplication considerationsApplication considerationsApplication considerationsUse idle timeout to free up resources for other Use idle timeout to free up resources for other heavyheavy--use applications.use applications.
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Consider disabling idle timeout if starting an Consider disabling idle timeout if starting an application takes a long time.application takes a long time.
View State ImprovementsView State Improvements
More efficient More efficient i li i fi li i fserialization format serialization format
reduces state sizereduces state sizeSplitting View StateSplitting View StateSplitting View State Splitting View State into Control State into Control State and UI Stateand UI State
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.
Site CompilationSite CompilationPrePre--Compile your websiteCompile your website
Use aspnet_compiler.exeUse aspnet_compiler.exeEndpoints reduced to empty files (aspx)Endpoints reduced to empty files (aspx)p p y ( p )p p y ( p )No requestNo request--time compilationtime compilation
/bin contains compiled assemblies for/bin contains compiled assemblies for/bin contains compiled assemblies for /bin contains compiled assemblies for entire siteentire site
Introduction To Web Application Architecture – PRATIK Gohil, SVICS, Kadi.