Caching is an effective means for reducing load on web servers, especially for those that dynamically generate documents in dynamic web applications. While adding caching to a web application can greatly reduce response times for requests, the logic to ensure consistency with the backend database requires considerable effort to develop. Much of the complexity is in minimizing unnecessary page invalidations, a key goal for improving the cache hit rate and response times. In this thesis I explore a range of invalidation policies that are progressively more precise. A policy is more precise than the other if it produces less false positives (removal of valid pages). A contribution of this work is in achieving precise invalidations at the application server layer automatically.
To explore these issues, I introduce AutoWebCache, a system for adding server-side caching for dynamic content automatically to web applications having a back-end database. To achieve automation, it uses aspect-oriented programming for injecting the cache code into the application. Dependencies between the read and write requests are determined automatically, during run-time. Formulating the dependencies requires SQL query analysis be performed at run-time, which is costly. I demonstrate how to reduce this dynamic analysis overhead through effective caching of intermediate analysis results. In two e-commerce benchmarks, RUBiS and TPC-W, I show my method can be highly effective, reducing the response times, 63% and 97%, respectively.