Presentation is loading. Please wait.

Presentation is loading. Please wait.

Building Scalable and Reliable Web Applications Vineet Gupta Technology Evangelist Microsoft Corporation

Similar presentations


Presentation on theme: "Building Scalable and Reliable Web Applications Vineet Gupta Technology Evangelist Microsoft Corporation"— Presentation transcript:

1 Building Scalable and Reliable Web Applications Vineet Gupta Technology Evangelist Microsoft Corporation http://spaces.msn.com/members/vineetgupta

2 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

3 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

4 DLLHost.EXE ISAPI Extensions DLLHost.EXE ISAPI Extensions Rearchitecting IIS A review of IIS5 TCP/IP kernel user WinSock 2.0 INETINFO.EXE Metabase ISAPI Filters and Extensions DLLHost.EXE ISAPI Extensions INETINFO.EXE Metabase ISAPI Filters and Extensions

5 web app 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: Http.sys: Kernel mode listener and request router WAS: Config and process manager W3wp.exe: Where Web apps are processed Multiple W3wp.exe files WAS W3wp.exe web app Http.sys Kernel W3wp.exe W3wp.exe Web App

6 Process Model Contrast IIS5 to IIS6 – Making it more robust HTTP.SYSHTTP.SYS TCP/IPConnections Requests User Mode Kernel Mode App2 Filters Worker Process App2 Filters App1 Filters WASWAS INETINFO metabase AppPool 1 AppPool 2

7 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 W3wp.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. Http.sys W3wp.exe ASP.NET WAS App pool W3wp.exe ASP.NET AppDomain AppDomain AppDomain AppDomain AppDomain AppDomain AppDomain AppDomain Application Pool W3wp.exe ASP.NET App pool

8 Demo Application Pools

9 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

10 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/CustomerFunctionalityReliability

11 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!!

12 Recycling Overlapping Recycle kernel user WAS HTTP.SYS Old Worker Process ISAPI Exts & Filters Web Proc. Core DLL Ready for Recycle New Worker Process ISAPI Exts & Filters Web Proc. Core DLL Shut down Request startup ready Request

13 Demo Process Recycling

14 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

15 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

16 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

17 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!

18 Demo Managing State

19 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

20 Dynamic Kernel Caching RequestResponse WithoutCacheWithCacheRequestResponse

21 ASP.Net 2.0 Caching Improvements Data Caching Data-set based data-sources can be easily cached Just set EnableCaching to true on data- source control Also set CacheDuration, CacheExpirationPolicy 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

22 ASP.Net 2.0 Caching Improvements Post-Cache Substituion Output Cache an entire page except XXX XXX must be a simple string Use Response.WriteSubstitution with callback Or Use Substitution Control with associated Callback method

23 Demo Caching

24 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

25 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.

26 View State Improvements More efficient serialization format reduces state size Splitting View State into Control State and UI State

27 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

28 Demo Cool Stuff Demo Cool Stuff

29 Agenda IIS 6.0 and ASP.Net Architecture Reliability State Management Caching Other Cool Stuff

30 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!

31 Questions? http://spaces.msn.com/members/vineetgupta

32 Your Feedback is Important! Please Fill Out the feedback form

33 © 2006 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "Building Scalable and Reliable Web Applications Vineet Gupta Technology Evangelist Microsoft Corporation"

Similar presentations


Ads by Google