|
SYS-CON.TV Webcasts
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Top Links You Must Click On
General Java Accelerating Java Web Application Environments with Dynamic Content Caching
Accelerating Java Web Application Environments with Dynamic Content Caching
By: Helen Thomas
Jul. 1, 2001 12:00 AM
E-business sites are increasingly utilizing dynamic Web pages since they enable a much wider range of interaction than static HTML pages can provide. Dynamic page generation, also known as dynamic scripting, allows a Web site to generate pages at runtime, based on various parameters. Delaying content decisions until runtime provides several advantages to Web sites, including greater personalization and interactivity. For instance, a site might recognize and greet a returning customer based on his login (or perhaps from a cookie stored on his machine), e.g., "Welcome, John Smith." A more elaborate customization scheme might provide John with a set of recommendations, based on his past purchases. Still another advantage of the dynamic content generation paradigm is that it allows greater control over content. Updates to content can be made in a single place (e.g., a database), rather than to every single HTML file, as is done in the case of static pages. This aspect allows a site to truly separate presentation from content. Java is the development environment of choice for dynamic sites for a number of reasons. The Java platform simplifies enterprise application development by utilizing standardized, modular components, by providing a complete set of services to those components, and by handling many details of application behavior automatically, without the need for complex programming. These features are part of the Java 2 Platform, Enterprise Edition (J2EE) standard, which provides many features including portability, support for Enterprise JavaBeans (EJB) components, Java Servlets API, and JavaServer Pages (JSP). Another advantage of using the Java development platform is that there is significant vendor support for Java-based scripting technologies among the high-end application server products.
The Impact on Server-Side Performance
Performance Acceleration Solutions
Dynamic Content Caching solutions can be categorized into two broad types: 1) application-specific solutions and 2) purpose-built solutions.
Application-Specific Caching Solutions
JSP cache tagging solutions allow page and fragment level JSP output to be cached. Fragment-level caching is enabled by marking or tagging the script code that produces cacheable output. When the script executes, if a tagged fragment is found in cache, then the script code that generates the fragment is bypassed. A key advantage of application-specific caching solutions is that they are cost-effective since the caching features are included with the product. There are a few drawbacks to be aware of, however. For instance, JSP cache tags are only capable of presentation-layer caching; thus these solutions provide little value for sites based on the Model View Controller (MVC) design paradigm, as virtually all of the "real" work is done within the servlets and business components. Another disadvantage of these solutions is that the caching process competes with the numerous other application server tasks for both CPU and memory resources. Furthermore, clustered implementations require multiple caches, creating issues in maintaining cluster-wide cache coherency. Purpose-built solutions are typically standalone products designed specifically to address the delays caused by dynamic page generation. They can be further classified into two categories: page-level and component-level caching.
Page-Level Caching
"http://www.xyz.com/catalog.jsp?catalogID=100" As long as the URL uniquely identifies the page that will be displayed, a page-level cache can store the resulting content to fulfill future requests. Vendors of Java-based solutions in this category include Oracle and Persistence Software. There are a number of advantages associated with page-level caching solutions. Since the entire page is cached, these solutions can completely offload work from the application server, as the request never reaches that resource. In addition, these solutions allow some degree of personalization (e.g., in cases where users sharing the same preferences are served the same content), and they are relatively simple to implement. On the other hand, there are several limitations to consider. By far, the most significant drawback is that caching only applies when the URL uniquely identifies a page. This is often not the case in dynamic Java-based sites, where complex business logic in the script determines the page that is created and served. In addition, on highly personalized sites page-level caching results in low cache hit rates since each page instance is unique to a user.
Component-Level Caching
The page consists of multiple components: Ad, Navigation, Headlines, and Personalized. While each page instance may be unique due to the Personalized component, it is likely that much of the content (e.g., Navigation, Headlines) will be the same for multiple requests during a given time interval. Component-level solutions capitalize on such reusability by caching and serving these components, eliminating the need for the application server to create them again and again. Implementation of component-level caching requires identification of the specific components that cause performance bottlenecks. The corresponding application code that generates such bottleneck components is tagged, which involves inserting an API into the script. When the script executes, the API instructs the application server to check for the component in cache before generating any content. The goal is to fulfill a high majority of requests from cache, thus producing site-wide infrastructure efficiencies. The only vendor in the component-level caching category is Chutney Technologies. With component-level caching, cache invalidation policies are vital. Components must always be kept up-to-date, so that "stale" data is never served. Several strategies for cache invalidation exist, the most popular of which are time-based, event-based, observation-based, and on-demand. Time-based policies are the most straightforward, and basically flush components at pre-set time intervals. Event-based invalidation is keyed on an external occurrence, such as a database update made by another application. In this case, the database is programmed to send a notification to the cache when a component's value changes. Observation-based policies are utilized by sites where updates to data sources occur inside the scripts, such as with exchange or auction sites. Finally, on-demand invalidation allows keywords or regular expressions to be used to remove cached components at the site administrator's discretion. To maximize flexibility, a component-level cache allows the use of all of these methods concurrently to accommodate the data's unique characteristics. There are several advantages to using component-level caching. Such solutions deliver high cache hit rates since most components have high reusability levels, if only for a brief time period. This factor enables even highly personalized sites to achieve significant performance benefits. In addition, component-level caching solutions typically reside on a separate machine, eliminating the resource contention problems that are inherent with application-specific solutions. This "separate-box" architecture allows for enterprise-class scaling, as a single component-level cache can interface with a rack of application servers. Also, unlike application server cache tagging, component-level caching can be applied within nested script calls at the business logic layer, where much of the work is done in Java-based architectures. A disadvantage of component-level caching solutions is that they require identification of the specific components that cause the most severe delays. This is either accomplished through site-specific knowledge or load profiling tools. After these components are identified, code-level integration is necessary to insert the appropriate caching tags within the scripts. Therefore, component-level caching's main tradeoff is one of implementation simplicity for maximized performance.
Putting the Solutions into Context
Conclusion
Reader Feedback: Page 1 of 1
Enterprise Open Source Magazine Latest Stories . . .
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||