2a2728c2db104a4b41f20426153edf63.ppt
- Количество слайдов: 33
Building Scalable and Reliable Web Applications Vineet Gupta Technology Evangelist Microsoft Corporation http: //spaces. msn. com/members/vineetgupta
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Rearchitecting IIS A review of IIS 5 DLLHost. EXE INETINFO. EXE DLLHost. EXE ISAPI Extensions ISAPI Filters and Extensions Metabase user kernel Win. Sock 2. 0 TCP/IP
IIS 6. 0 Architecture Goal: Enable complete app isolation from other Web apps and core Web server Web service in INETINFO split out to do this: Multiple W 3 wp. exe files web web app Web app App Kernel Http. sys: Kernel mode listener and request router WAS: Config and process manager W 3 wp. exe: Where Web apps are processed WAS W 3 wp. exe Http. sys
Process Model Contrast IIS 5 to IIS 6 – Making it more robust App. Pool 1 App. Pool 2 Worker Process INETINFO WAS metabase Worker Process App 1 App 2 Filters Requests User Mode Kernel Mode HTTP. SYS TCP/IP Connections
ASP. Net on IIS 6 . NET Application Domains vs. Application Pools Application domains Lightweight CLR unit of isolation One app domain per IIS application Combine with W 3 wp. exe files to achieve high scalability and isolation ASP. NET manages app domains independently Recycled within a single process Can have private components, session variables , etc. App pool W 3 wp. exe WAS W 3 wp. exe ASP. NET Http. sys Application Pool W 3 wp. exe ASP. NET App App Domain App Domain
Demo Application Pools
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Application Pools Application Isolation in Processes Can create 1 or more application pools Each served by 1 or more processes. Each worker process serves only 1 pool. Reqs routed directly to pool by HTTP. sys Isolate apps based on: Site/Customer Functionality Reliability
Recycling What is it and Why use it? What is it? Periodically restart applications based on: Uptime # of requests Scheduled time Memory consumption On-demand Why use it? Refresh apps to ensure availability Prevent bad apps from taking over the system No interruption in Service!!
Recycling Overlapping Recycle New Worker Process Web Proc. Core DLL ISAPI Exts & Filters Old Worker Process Web Proc. Core DLL ISAPI Exts & Filters user kernel HTTP. SYS Request Ready for Shut down Recycle WAS startup ready
Demo Process Recycling
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Increasing. NET Scale & Performance Attributes of Scalable Web Applications Stateless Application code and components can be restarted cheaply; session state is managed externally in some sort of state store Low initialization costs Applications should avoid doing heavy processing at startup or assume that they will run for a long time
Increasing. NET Scale & Performance Attributes of Scalable Web Applications (2) Can have multiple instances All the components and classes of an application should be able to have multiple instances in separate processes without namespace or locking issues Expect administrator-imposed limits Your application is likely to have CPU limits Memory limits Processor affinity imposed
Making Applications More Reliable Web Farm Session State Session state can be stored in an external process ASPState Service Microsoft® SQL Server™ 2000 Big reliability wins Session state survives crashes/restarts Enables Web farm deployment Session state can now be shared across a Web farm of ASP. NET servers Applications no longer tied to one computer Design your apps to be recycled!
Demo Managing State
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Dynamic Kernel Caching With Cache Without Cache Request Response
ASP. Net 2. 0 Caching Improvements Data Caching Data-set based data-sources can be easily cached Just set Enable. Caching to true on datasource control Also set Cache. Duration, Cache. Expiration. Policy SQL Cache Invalidation for Stale Data SQL 7, 2000 use a custom change table, a DB trigger and a polling mechanism by ASP. Net SQL 2005 uses Service Broker
ASP. Net 2. 0 Caching Improvements Post-Cache Substituion Output Cache an entire page except XXX must be a simple string Use Response. Write. Substitution with callback Or Use Substitution Control with associated Callback method
Demo Caching
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Resource Optimization in IIS 6 Idle Timeout and Demand Start Idle timeout Timeout and shutdown idle processes if process is idle for given period of time. Frees resources for active applications. Apps still available even if worker process idles out and is shut down! Demand start Only start worker process if there is demand for the application pool. Application considerations Use idle timeout to free up resources for other heavy-use applications. Consider disabling idle timeout if starting an application takes a long time.
View State Improvements More efficient serialization format reduces state size Splitting View State into Control State and UI State
Site Compilation Pre-Compile your website Use aspnet_compiler. exe Endpoints reduced to empty files (aspx) No request-time compilation /bin contains compiled assemblies for entire site
Demo Cool Stuff
Agenda IIS 6. 0 and ASP. Net Architecture Reliability State Management Caching Other Cool Stuff
Recommendations Move to IIS 6 and ASP. Net 2. 0 Design Apps for Recycling Design Stateless Apps Or think out-of-proc state management Use Caching wherever you can!
Questions? http: //spaces. msn. com/members/vineetgupta
Your Feedback is Important! Please Fill Out the feedback form
© 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
2a2728c2db104a4b41f20426153edf63.ppt