Web Cache Dirty Flag Management via Database Triggers
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Web-based database applications face significant processing speed bottlenecks due to time-consuming database queries, particularly when retrieving data for complex web pages, which can take several seconds to generate even with powerful servers.
Innovation Solution
Implementing a method that uses database triggers to manage a web page cache by setting a 'dirty flag' in a web page cache table, allowing cached web pages to be quickly verified and reused if unmodified, and reconstructed and cached if modified, thereby reducing delivery time.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If database queries are executed to retrieve data for web pages, then data accuracy is ensured, but processing time increases significantly
Solution Approach 1:
The patent pre-generates web pages by executing database queries in advance and storing the results in a cache. When a client requests a web page, the system first checks the cache for an existing copy. If found, the cached page is returned immediately without re-executing the database queries, thus eliminating the time-consuming data retrieval process while maintaining data accuracy through the use of dirty flags to track changes.
2Speed
If web pages are cached to reduce processing time, then delivery speed improves, but system complexity increases due to cache management
Solution Approach 1:
The patent implements a feedback mechanism using dirty flags in the cache table. When database data changes, the corresponding dirty flag is set to indicate that the cached web page is no longer valid. The system continuously monitors these flags and automatically invalidates or updates cached pages when needed, providing real-time feedback on cache validity without requiring complex manual management or frequent full cache invalidations.
3Loss of time
If cached pages are reused without verification, then delivery time decreases, but data reliability deteriorates
Solution Approach 1:
The system checks the dirty flag status before serving cached pages. If the dirty flag is not set, the cached page is served immediately, ensuring fast delivery. If the dirty flag is set, indicating that underlying database data has changed, the system invalidates the cache and regenerates the web page from the database, thus maintaining data reliability while minimizing delivery time through intelligent cache validation.
Data Source
AI summary
A method and apparatus for providing web pages to a client with improved speed and efficiency. Web pages are cached in a web server and are referenced from a database in a database server. When a request from a client is sent to the web server for a web page, the web server checks the web page cache table in the database server. The web page cache table contains a field wherein a flag is set to indicate whether any data that affects the web page has been updated. Database triggers are used to change the value of the flag when specified data fields corresponding to a web page have been changed. If the value of the flag indicates that there has not been any change in the data, the web server reads the html file reference in the web page cache table, retrieves the corresponding page from the web page cache in the web server and sends the page back to the client. If the value of the flag indicates that the data has changed, the web server reconstructs the web page from the database, caches the web page and resets the value of the flag before sending the web page to the client. The method and apparatus of the present invention is capable of delivering cached web pages in a much shorter time than is needed to generate the web page each time a request is received from a client.


