next up previous contents
Next: Persistency Up: The ConceptBase Server Previous: The ConceptBase Server

The Cache Subsystem

 

Since version 5.2.4 ConceptBase features a new query evaluation method which uses a so-called cache to store intermediate results of predicates that are called during the query evaluation. Assume, for example, that an employee 'bill' has two projects 'p1' and 'p2'. Then, the result of a predicate '(bill hasProject x)' with variable x would be the set {(bill hasProject p1),(bill hasProject p2)}. We call this result set also the extension of the predicate.

After a completed predicate evaluation, the cache of the predicate holds its extension. The cache speeds up query evaluation and prevents infinite loops when ConceptBase evaluates recursive queries and deductive rules. Essentially, the cache-based evaluation allows to compute dynamically stratified semantics of the Datalog database underlying ConceptBase. Plenty of examples for recursive rules and queries are provided in the online ConceptBase Forum.

The ConceptBase server provides three cache modes to control the behavior during query evaluation:

-c off
In this mode, the cache is completely disabled. Use this mode when your models doesn't include recursive rules and you want maximum performance. The mode is primarily provided for backward compatibility and is not recommended.

-c transient
This is the default mode. The cache is emptied before each transaction (ask, tell, untell, retell). A subsequent query is always evaluated starting with empty caches.

-c keep
The cache is only emptied when necessary, i.e. when the cache has been invalidated by an update to the database, or when the maximum number of tuples in the cache is exceeded. The maximum number is currently set to 10000. If necessary, the cache emptying takes place before a transaction. The keep mode is on average consuming more main memory than the transient mode but speeds up response time enormously in case of re-use of query results.

Some statistics on cache usage are written to the terminal window of the ConceptBase server when the tracemode has been set to high or veryhigh.

Acknowledgements: Though developed independently, some ideas for realizing the cache-based query evaluator are similar to the implementation of the XSB System [http://xsb.sourceforge.net/]. In contrast to XSB's strategy of modify the Warren Abstract Machine, our modification to the SLDNF-style topdown evaluation is realized as a Prolog meta program using efficient data structures for the storage of the predicate extensions.


next up previous contents
Next: Persistency Up: The ConceptBase Server Previous: The ConceptBase Server

ConceptBase Team