A cache that is running optimally is a critical component of high-performance applications. But there can be a challenge for the application during cache start up since there can be higher latency due to initial cache misses. Let’s learn about how to handle that better with cache warmup.
Oracle True Cache – a unique developer friendly cache
A quick refresher for the readers who may be new to True Cache – Oracle True Cache is an in-memory, consistent, and automatically managed cache for Oracle Database. True Cache is a SQL cache as well as key-value (object or JSON) cache for the database. It caches all Oracle database objects and types. True Cache is a fully functional, read-only replica of the primary database, except that it’s mostly diskless. One of the most awesome features of True Cache is that it is automatically managed, saving application developers from having to manage the cache in their caching tier, managing cache consistency or time-to-live of items in their cache. This is all managed and truly makes the lives of application developers so much easier!
Why is the Cache cold?
Let’s first see what is meant by a cache hit and a cache miss.
A cache hit occurs when the system successfully retrieves data from its cache memory (in this case from True Cache). For this to happen, the data must have already been present in the cache and hence can be accessed quickly. This is the preferred scenario and enables the benefits of the cache to boost application performance. This can also help offload queries and reduce the number of requests to a primary database.
A cache miss happens when the requested data is not found in the cache, forcing the system to retrieve it from the primary database, resulting in some performance penalty and also some load on the primary database.
Now, when the cache first boots up, the cache starts cold. A cache cold on startup means that when a system or application first starts up, its cache is empty, meaning it has no stored data readily available. Because the cache is empty, every request needs to go to the original data source (primary db), causing a noticeable delay in response time.
Warm up period
As True Cache starts receiving requests, the cache gradually fills up with frequently accessed data, transitioning from cold to warm and eventually hot as the cache becomes more efficient.
Why is cache warming important?
Pre-populate the cache: Before the system is exposed to real application traffic, proactively load frequently accessed data into the cache. This cache warming is a concept which is used to optimize the performance of the application by preloading the cache with frequently accessed content. By doing this, the data is readily available in True Cache, reducing the time it takes to serve it to the application/user. This results in a faster and more efficient user experience.
When an application requests data, it is retrieved from True Cache, or the primary database or from both. If the data is not in the cache, the system must fetch it from the primary database, which may take longer. The longer it takes to fetch the data, the slower the application, and bigger the impact on the user experience or processing throughput. Cache warming eliminates this problem by preloading the cache with frequently accessed content, ensuring that it is always available for application/users.

What are the benefits of cache warming?
- Faster data access times: By preloading the cache, cache warming reduces the latency associated with the initial cache miss. Since this strategy increases the cache hit, the data is served to the application faster, resulting in a faster and more seamless application and user experience.
- Reduced load on the primary database: By caching data, the load on the primary database is reduced, freeing up resources and improving the overall performance of the application and system.
- Improved scalability: True Cache helps with improving the overall scalability of the application and in fact, multiple True Cache instances can also be deployed for higher scalability
- Higher user engagement and achieving application SLAs: A faster and more efficient application will keep the users engaged and results in better availability too.
- Optimal use of the cache: By warming the True Cache with frequently accessed data, this strategy optimizes the use of True Cache space and ensures that valuable resources are used for data that most benefits the application usage.
Conclusion
Warming the True Cache is an effective technique for optimizing the performance of an application. By preloading the cache with frequently accessed data, the system is able to answer queries faster, resulting in a more streamlined and efficient application experience. Whether you implement cache warming manually (executing queries manually), or any automation including custom tools or scripts you use for warming the cache which fronts for your primary database – the benefits of cache warming are clear and well worth the effort.
Resources for further information:
True Cache home: https://www.oracle.com/truecache
User Guide: True Cache User Guide
Live Labs: How to access Live Labs for True Cache
Video: Video presentation
