asp tutorials, asp.net tutorials, sample code, and Microsoft news from 15Seconds
Data Access  |   Troubleshooting  |   Security  |   Performance  |   ADSI  |   Upload  |   Email  |   Control Building  |   Component Building  |   Forms  |   XML  |   Web Services  |   ASP.NET  |   .NET Features  |   .NET 2.0  |   App Development  |   App Architecture  |   IIS  |   Wireless
 
Pioneering Active Server
 Power Search





Active News
15 Seconds Weekly Newsletter
• Complete Coverage
• Site Updates
• Upcoming Features

More Free Newsletters
Reference
News
Articles
Archive
Writers
Code Samples
Components
Tools
FAQ
Feedback
Books
Links
DL Archives
Community
Messageboard
List Servers
Mailing List
WebHosts
Consultants
Tech Jobs
15 Seconds
Home
Site Map
Press
Legal
Privacy Policy
internet.commerce














internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

HardwareCentral
Compare products, prices, and stores at Hardware Central!

Dynamic Caching
By Wayne Berry
Rating: 3.2 out of 5
Rate this article


  • email this article to a colleague
  • suggest an article

    Introduction


    Caching happens at all levels, on the hard drive, in RAM, and within the operating systems. It is a performance fundamental of computer science. In 1999, a wave of caching products swept the Internet to serve graphics faster. These products drove the stock of companies like Akamai Technologies, Inc., and Inktomi Corp. into the sky. However, they were focused on caching graphics and streaming media.

    Now a new wave of caching products are emerging that cache dynamic Web pages. Dynamic Web pages are those that are created between the request for the page and the response back to the browser. Usually they are written in a scripting language like perl, CGI, VBScript, or Cold Fusion. In the past, these pages were used to provide personalization and e-commerce transactions. However, as the Web evolves, dynamic pages are being used to generate content-like promotions for the front page, changing indexes and mainstream content. Because these types of pages are being used for Web-site maintenance and not user interactivity, they can be cached for short periods of time.

    Dynamic caching's time has come, Post Point Software launched a released of XCache in May, Microsoft plans to release ASP+ and Acceleration Server next year, Cold Fusion released SPECTRE at the end of 1999, and Vignette's Story Server lists caching as one of their main features. However, if you are writing your Web site in Active Server Pages (ASPs), it was not until XCache that you could implement partial page caching (the ability to cache just a portion of the page, leaving the rest dynamic). This ability allows you to incorporate personalization without losing performance.

    This article will cover three ways to cache your dynamic Web site written in ASPs, including Microsoft Acceleration Server, Microsoft's ASP+, and Post Point Software's XCache, and offer the pros and cons of using each product. If you are looking for speed and scalability for the Web site, read on.

    Microsoft Security and Internet Acceleration Server (ISA)

    Microsoft's Security and Internet Acceleration Server, a.k.a. ISA (<a href="http://www.microsoft.com/isaserver/"> http://www.microsoft.com/isaserver</a> ), is the third version of their reverse proxy server (still in beta). The ISA server is typical of reverse proxy servers and is somewhat advanced in its handling of URLs with question marks (dynamic pages). While most reverse proxy servers don't recognize query strings as unique identifiers to the pages, ISA does cache each page with unique query strings as separate pages.

    What is a Reverse Proxy Server?

    The proxy server sits between the Internet and the Web site and handles all traffic before it can reach the Web server. A reverse proxy server intercepts requests to the Web server and instead responds to the request out of a store of cached pages. This method improves the performance by reducing the amount of pages actually created "fresh" by the Web server.

    Reverse proxy servers cache pages based on HTTP header tags that are returned from the dynamic pages. The four most important are:

    Last-Modified     Tells the proxy when to change the page. Expires     Tells the proxy when to drop the page. Cache-Control     Tells the proxy if the page should be cached. Pragma.     Tells the proxy if the page should be cached.

    For example, by default all Active Server Pages return "Cache-control: private." Which means that none of your Active Server Pages will be cached with Microsoft's Acceleration Server.

    Advantages

    The ISA server runs on a separate machine that distributes the load from the Web server to the Acceleration Server. The ISA server also serves everything from RAM, making it extremely quick.

    Disadvantages

    With the ISA server you need to recode your Active Server Pages in order to cache them -- Active Server Pages default HTTP response headers will tell the ISA server not to cache its pages. Because the ISA server sits on a separate machine, none of the cached requests make it to the Internet Information Server's log files. This means that even though those pages are being requested, there is no record of it on the Web server, so your traffic numbers are not accurate when running ISA.

    Example

    When you want to change your cache in ISA, you will need to change to code that controls the ASP page. In order to turn CacheControl off, you will need to reprogram your ASP pages by adding:

    
    <%
    	Response.AddHeader "CacheControl","public"
    %>
    
    

    You also need to tell the proxy when the page expires so that it can refresh the cache appropriately. Add this line to set the cache period to 1 hour:

    
    <%
    	Response.Expires = 60
    %>
    
    

    Microsoft's Security and Internet Acceleration Server can be used for caching Web pages if you don't mind recoding your site, however other caching systems handle dynamic pages better, such as Microsoft's ASP+ and Post Point's XCache.

    Active Server Pages Plus

    ASP+ is an extension of Microsoft's Active Server Pages. This completely new approach to Active Server Pages is scheduled to be release in early 2001. Basically, ASP+ is a set of tools that extends the Microsoft Internet Information Services (IIS) server. However, unlike other ASP upgrade paths, you need to recode your current ASP pages to take advantage of Microsoft's new "managed code" scripting languages and ASP+ features. If you do recode your Web site, you can add a directive to each page to cache it.

    ASP+ provides two types of page caching: one called output caching that caches a whole page for a period of time, and another called partial page caching that caches just a portion of the page or several portions. Both require you to recode each page you want to cache adding the correct directive.

    The concept of partial page caching is a very powerful tool, since pieces of the page might stay the same no matter what user is viewing the page and other pieces might be different on a per-user basis. Partial page caching allows you to put your most expensive routines in a long-term cache and leave your banner rotation and personalization pieces of the Web site completely dynamic.

    Advantages

    ASP+ provides both output page caching and partial page caching for free. It allows you to divide your cache by the browser's language and browser type. This gives you a bigger cache, however if you are creating unique pages by language or browser type, this is a big benefit.

    Disadvantages

    ASP+ requires that you recode your ASP pages in order to take advantage of the new ASP+ features. Microsoft also requires that you add directives to the top of the page in order to cache. ASP+ is in beta and will launched in early 2001.

    Example

    The following output caching directive is applied to the top of the page:

    
    <%@ OutputCache Duration="60" %>
    
    

    Because ASP+ is still in beta, Microsoft has not yet released details on the syntax for the partial page cache directive.

    XCache

    XCache is a third-party tool from Post Point Software ( http://www.postpointsoft.com) that allows you to cache Active Server Pages in IIS 4.0 or IIS 5.0. Unlike ASP+, it is currently available. It was released in May 2000. Like ASP+, XCache has the ability to perform output caching and partial page caching -- called Active Caching.

    XCache installs on your Web server, handling requests before they reach the Web server. In this regard it is much like a reverse proxy server. However, unlike a reverse proxy server, XCache makes sure all requests that are served from the cache are reflected in your log files. This can be a problem with other caching solutions that are not on the box -- when requests are served from the cache, hits are not logged. This makes analyzing your Web site traffic impossible.

    To start using XCache, install it on your Web server and start it from the MMC Snapin that is provided. You can pick and choose those pages you want to cache, leaving pages that change on a per-user basis uncacheable.

    Advantages

    XCache doesn't require recoding to do output caching and provides partial page caching. Requests severed from the cache are logged to the Web server log files. XCache is currently available.

    Disadvantages

    XCache uses a disk cache to hold files instead of a RAM cache like the ISA server.

    Example If you want to implement Active Caching (partial page caching), just turn it on from the Web site properties page. Once you have it enabled, you can choose which section of the page you don't want to cache by changing the delimiters from <% %> to <$ $>. XCache will then cache everything in <% %> and leave everything in <$ $> to execute when the user requests the page.

    XCache also allows you to include pages when the file is cached by using the standard #include or include pages when the page is requested using #dynamic. For example, changing:

    
    <!-- #include virtual="/dir/include.asp"-->
    
    to
    
    <!-- #dynamic virtual="/dir/include.asp"-->
    
    
    
    will make all the code in include.asp execute when the page is requested. Includes left in
    
    
    <!-- #include virtual="/dir/include.asp"-->
    
    
    
    will execute when the page is cached.

    Performance Gains

    You can see significant performance gains using ISA, ASP+, or XCache, depending on the scenario. Imagine you have hundreds of graphics on your Web server that are taking the majority of the servers processing time and bandwidth. You could cache these with the ISA server, reducing the load on the Web server and allowing it to process more ASP pages. At the same time the ISA server would load the graphics into memory, serving them faster than the Web server could from the hard drive.

    Now image you have a product catalog in your SQL Server database of 5,000 products. Typically you would have a category page that lists products in that category and a detail page that displays all the information about the product. These pages would be driven directly from the database, allowing you to change and add products easily. Now imagine that certain products are not changed for months. This means that their detail page has not changed. However, every time that page is requested, code has to be executed and SQL Server calls have to be made to see exactly the same page that was displayed to the last user..

    In this scenario, caching is the solution. You would cache your detail pages, and all requests would come out of cache, instead of executing. This would reduce the calls to the SQL Server and reduce the CPU load on the Web server. Pages would return faster and the Web server would be able to serve more pages since it has less work to do.

    Suppose on the same Web site, you have a shopping basket that allows each user to purchase those products in their shopping cart. In this scenario each user would see a different version of the page since they would be purchasing different products. You would not want to cache these pages since they change for every user and the pages need to interact with the database.

    However, on the site's home page you have specialty promotions that are based on information you have tracked about each user. Along with these promotions there is a list of all the categories. This page changes on a per-user basis, however most of the information is the same for all users. This is a perfect scenario for partial page caching. You could cache the category list, indexes, and navigation, essentially everything but the promotions -- and this would leave the promotions dynamic.

    Summary

    There is a new wave of caching products hitting the market that allow interactive pages to benefit from Web page caching. Three of the front-runners are Post Point Software's XCache, Microsoft's ASP+, and Microsoft's Security and Acceleration Server. Take a close look at your Web site and determine if you could benefit from dynamic caching.

    About the Author

    Wayne Berry is the president and CEO of Post Point Software, as a former Microsoft design engineer and one of the top Active Server Page developers in the country, Berry's expertise includes software design, development, marketing and online business. Berry served as a Software Development Engineer at Microsoft and as Director of Development at Freeshop prior to Post Point Software.

    A popular speaker, Berry has been invited to speak to international ASP Developers conferences, BackOffice Conference and Internet World. He has authored several technical books, including ActiveX Unleashed Programming, Windows Registry Guide, and Special Edition Using Microsoft Internet Information Server 4.0. , as well as many articles in print and online trade publications.

    Berry holds a B.S. in Computer Science from Western Washington University.

  • Rate This Article
    Not HelpfulMost Helpful
    1 2 3 4 5
    Supporting Products/Tools
    XCache
    XCache combines dynamic content caching technology with content delivery network (CDN) support options, file compression and a whole lot of manageability features to help e-businesses deliver superior web site performance and reliability. You'll appreciate the administrative ease, your visitors will appreciate increased page delivery speed.
    [Top]
    XCompress
    XCompress works by compressing outgoing text between the Web server and the client. Page response times may improve by a factor of three or more while overall bandwidth use can drop by two thirds or more.

    XCompress runs on Windows 2000 and Windows NT 4.0 and is tightly integrated with Microsoft Internet Information Server (IIS) with MMC and COM interfaces.

    [Top]
    XTune
    XTune 2.0 is the most powerful tuning application for IIS 4 or IIS 5 ever conceived. Indispensable to the enterprise and straightforward, this web tuning tool allows you to configure hidden operating system, network, Active Server Pages and Internet Information Server settings for better performance, without any additional hardware or software.

    This version scans your system more deeply, offering more performance-enhancing recommendations and greater insight into your web architecture. The Performance Wizard guides and teaches you throughout the complete tuning process, so you can learn while making your box run better than ever.

    Purchase here.

    [Top]
    Other Articles
    Aug 25, 2005 - Performance Monitoring in SharePoint Portal Server 2003
    Performance monitoring helps organizations identify performance bottlenecks. The problem is that with so many performance numbers available, how do you know which ones to watch? This article helps you identify which are the critical performance counters in a SharePoint Portal Server environment and explains how to monitor them. By monitoring performance regularly, organizations can recognize performance trends as they develop and prevent problems before they get out of hand.
    [Read This Article]  [Top]
    Aug 12, 2004 - Middle-Tier Hosting: Enterprise Services, IIS, DCOM, Web Services, and Remoting
    There is broad-reaching debate about remoting, Web services, Enterprise Services, and DCOM. In short, it is a debate about the best technology to use when implementing client/server communication in .NET. Rocky Lhotka shares his thoughts on the issue while offering clear explanations of basic application architecture terminology.
    [Read This Article]  [Top]
    May 18, 2004 - ASP.NET 2.0 Caching Features
    This article examines some of the new and exciting caching features in ASP.NET 2.0 and shows how to implement them in Web applications.
    [Read This Article]  [Top]
    Feb 12, 2004 - Case Study: Match.com
    When it came time to find a technology for its massive upgrade, Match.com chose .NET. Has the online dating service's partnership with Microsoft been as successful as the relationships it has established for many of its millions of members? Read on ...
    [Read This Article]  [Top]
    Jan 15, 2004 - Database Performance Philosophy
    Longtime 15Seconds discussion list member Tore Bostrup offers valuable advice on designing databases and applications for efficient querying.
    [Read This Article]  [Top]
    Dec 29, 2003 - Caching Oracle Data for ASP.NET Applications
    Narayan Veeramani shows how ASP.NET developers can improve application performance by caching data stored in an Oracle database and keeping the cached data in sync with the data in the Oracle database.
    [Read This Article]  [Top]
    Dec 2, 2003 - Leveraging MSMQ in ASP.NET Applications
    Ever developed a Web application that requires extensive processing? Ever had long running Web pages that often time out in the browser? Greg Huber reveals a simple technique that uses Microsoft Message Queuing (MSMQ) and the System.Messaging framework to handle long running Web processes.
    [Read This Article]  [Top]
    Mar 14, 2002 - Web Site Compression
    As IT professionals try to reduce the cost of operating their Web sites, they should consider reducing the amount of bandwidth usage. Learn how to successfully compress your HTML output and save money on your monthly bandwidth.
    [Read This Article]  [Top]
    Feb 6, 2002 - The Just Two Theory on Web Servers
    Maintaining a large Web farm is both costly and unnecessary. Learn how to reduce your Web farm to just two servers in this controversial article by Wayne Berry.
    [Read This Article]  [Top]
    Aug 14, 2001 - NT Authentication's Impact on Connection Pooling
    Steve Witkop examines OLE DB and ODBC connection pooling when used with Microsoft NT LAN Manager Web server authentication.
    [Read This Article]  [Top]
    Mailing List
    Want to receive email when the next article is published? Just Click Here to sign up.

    Support the Active Server Industry