Oracle True Cache is a read-only, consistent cache for Oracle Databases. It allows applications to read data from a cache instead of hitting the primary database every time, without sacrificing data accuracy.
Oracle True Cache is available starting with Oracle Database 23ai.
True Cache is useful when your application;
Has read-heavy workloads
Experiences high latency accessing the database
Needs to scale reads without scaling the primary database
How True Cache Works
When an application sends a query, Oracle first checks the True Cache to see if the requested data is already available and still valid. If the data is found in the cache, it is returned immediately, allowing the application to get results with much lower latency and without putting load on the primary database. If the data is not present in the cache, Oracle retrieves it from the primary database, returns it to the application, and stores a copy in the cache for future requests. Whenever the data changes in the primary database, Oracle automatically refreshes or invalidates the cached data to ensure that all subsequent reads remain consistent and accurate.
How to Enable Oracle True Cache
To enable Oracle True Cache, first ensure your primary Oracle Database supports the feature and identify read heavy data that would benefit from caching.
Next, provision a separate Oracle Database to act as the True Cache and securely connect it to the primary database.
Configure database services so that read-only queries are automatically routed to the cache while write operations continue to go to the primary database.
Finally, point your application to the cache enabled service and monitor performance to fine tune cache usage.
Usually it ccan be implemented without needing any application code changes.
Below are some sqls you can use:
Use this to view parameters related to True Cache
SHOW PARAMETER cache;
SELECT name, value FROM v$parameter WHERE name LIKE '%cache%';
Monitor Cache Usage and Performance
SELECT * FROM v$sysstat WHERE name
LIKE '%cache%';
As a summary , Oracle True Cache offers a simple way to scale read performance while maintaining data correctness. With minimal configuration and little to no application changes, it can significantly reduce database load and improve user experience.
Comments
Post a Comment