Arnica NanoQuery Cache Modes

January 28, 2024 by Igor Lozhkin
Arnica NanoQuery works as a pass-through cache. Applications which would typically use ODBC to access databases can send queries to NanoQuery. 

NanoQuery executes the query against a target database. Results can be immediately returned to the application or cached and returned from cache.

Each query sent from the application is accompanied with cache mode specification. NanoQuery uses this specification to provide either a real-time or cached response. Such cache mode specification is applied per query, meaning that different queries may engage different operating mode.

Below is a summary of operating modes, applicable per query:

Real-time - query is sent to target database and results are returned to application immediately. Cache is not created.

Cached with RTT - query is sent to target database and results are either returned to application immediately or stored in memory. RTT stands for RealTime Trigger. When RTT is engaged, the query is first processed in real-time mode. NanoQuery continuously monitors query response time and engages cached mode if execution time exceeds specified threshold. Query execution mode is automatically switched back to real-time mode when next cache renewal query is executed faster than the specified threshold.   

Cached in memory - query is sent to target database and results are stored in memory. Results are returned to application from memory (either immediately in case of recently renewed cache, or immediately from previously renewed and not expired cache). Caching to disk is not engaged.

Cached in memory with disk copy - query is sent to target database and results are stored in memory and on disk. Results are returned to application from memory (either immediately in case of just renewed cache, or immediately from previously renewed and not expired cache). Caching to disk is engaged only at the moment of cache renewal and is used only if NanoQuery service is restarted to re-initialize in-memory store.

Cached on disk only - query is sent to target database and results are stored on disk, with memory used only for storing metadata. Results are returned to application from disk. 

Cached in CacheDB - query is sent to target database and results are stored on disk in CacheDB, managed by NanoQuery. Application receives only success (or failure) flag. Memory is used only for storing metadata. Application may send multiple queries to store results in the same CacheDB instance with the purpose of subsequent processing in CacheDB.

Processed in CacheDB - query is sent to be executed against tables accumulated in specified CacheDB instance, which is stored on disk and managed by NanoQuery. Application receives only success (or failure) flag. Memory is used only for storing metadata. Application may send multiple queries to process data in CacheDB and may produce additional results (tables) in CacheDB.

Read from CacheDB - query is sent to be executed against tables accumulated in specified CacheDB instance, which is stored on disk and managed by NanoQuery. Results are returned to application similar to how the cached results are returned.