Browse Prior Art Database

Use Dirty Fields Index of Persistent Objects to Optimize Cache Invalidation and Improve Performance Disclosure Number: IPCOM000126023D
Original Publication Date: 2005-Jun-28
Included in the Prior Art Database: 2005-Jun-28
Document File: 1 page(s) / 19K

Publishing Venue



The Enterprise Java Beans (EJB) specification defines bean lifecycle methods of ejbCreate/ejbStore/ejbRemove to control creating/updating/removing of an EJB entity bean , which has a physical data representation in a datastore(e.g. a row in relational database table). Methods ejbFind<>/ejbSelect<> are defined to query beans that satisfy the search condition. Most applications will have some data that seldom gets updated. To avoid database round trip (which is the most important factor that affecting performance), it is better to cache this data. One way to cache is to cache a query result, e.g. if we have a catalog , usually people will search the catalog type. We can cache the result for type ="electronics" and "books", so the next person that does the same search will get the result from memory immediately without having a database trip. Caching is good, but it needs to be accurate, otherwise it will reflect the wrong data. So whenever there is a change that affects the cache result, we need to invalidate the cache to make sure the next time we do the query we go to database to retrieve the most recent data. But if we invalidate cache unnecessary, it will have performance impact.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 58% of the total text.

Page 1 of 1

Use Dirty Fields Index of Persistent Objects to Optimize Cache Invalidation and Improve Performance

This invention introduces a mechanism to optimize "cache invalidation" by matching the dirty field index and the field index that affects the query result, so we only invalidate cached query results when the beans' changed fields are the ones the query depends on. For example, if a catalog entry changed the "description", as it will not affect the query result of query on "type", the cache is still valid and should not be invalidated; while if it is query by "description", the cached query should be invalidated.

This invention is targeted to EJB CMP. The same scheme can be used by other object persistence systems which utilize cache.

Prior to this invention, results cache invalidation was done at the level of the whole bean. That is, any bean referred to in any way in the query WHERE clause was considered part of the query scope for that query, such that any update to any bean in the query scope of a query caused invalidation of that query's cached results. With this invention, invalidation is done at the finer-grained level of fields within a bean; as a result, fewer cached results are invalidated (meaning better performance) while still maintaining cache currency.

To achieve this cache invalidation optimization, we here describe one illustrative embodiment:

First, when we cache the query result, we also needs to know what cmp fields (cmr fields) will affect the q...