Quantcast
Channel: Archives des Performance - dbi Blog
Viewing all articles
Browse latest Browse all 66

Oracle 23ai – True Cache

$
0
0

Introduced in Oracle 23ai is a feature called “True Cache”, which is part of Oracle’s in-memory database solution designed to optimize database performance by leveraging various caching mechanisms.

To give you a short summary how True Cache works and what is really new in Oracle 23ai, I will show a short comparison of the related features in 19/21c and 23ai:

Oracle 19c and 21c Caching and Replication Features:

Active Data Guard: Oracle 19c and 21c include Oracle Active Data Guard, which allows offloading to a synchronized standby database for real-time queries, which provides a read-only replication of the primary database, to balance load and ensuring high availability.

Database In-Memory: These versions support Oracle Database In-Memory, where data is stored in a compressed columnar format in memory to accelerate analytics and mixed workloads by providing fast query performance.

Buffer Cache: Oracle’s traditional buffer cache mechanism stores frequently accessed data blocks in memory, reducing the need for disk I/O operations. This is the fundamental caching strategy present since Oracle 6!

Smart Flash Cache: Oracle Database Smart Flash Cache (since Oracle 11g, R2), available on certain configurations, extends the buffer cache using flash storage, enhancing performance on systems with limited RAM.

True Cache in Oracle 23ai:

Full Functionality & Read-Only Replication: True Cache now provides a fully functional, read-only replication of the primary database. Unlike traditional read-only replicas, True Cache aims to be mostly diskless, relying heavily on in-memory structures to satisfy the queries.

Enhanced Buffer Cache Utilization: True Cache is designed to satisfy queries using only data from its own buffer cache, reducing dependencies on disk storage and thereby improving query performance. This focus on using in-memory data exclusively helps to achieve faster response times.

Diskless Design: While Oracle Active Data Guard involves both, disk and memory for maintaining the standby database, True Cache minimizes disk usage, which can be particularly beneficial for environments aiming for high-speed data retrieval and lower latency.

Integration and Automation: Oracle 23c’s True Cache likely integrates more seamlessly with other Oracle autonomous features, providing advanced automation in managing the cache, optimizing performance without significant manual intervention.

Target Use Cases: True Cache is particularly advantageous for read-heavy workloads where data consistency and speed are critical. Its design ensures that frequently accessed data is always available in memory, catering to applications that demand high read throughput and low latency.

Configuring True Cache:

To configure Oracle True Cache in Oracle 23c, you need to follow a series of steps to ensure that your system is set up correctly to leverage this feature effectively. Here’s a high-level guide to configuring True Cache manually and understanding its requirements:

Checking System Requirements: Ensure that your Oracle 23ai database environment meets the necessary hardware and software requirements and that you have enough memory to support the in-memory caching feature. True Cache will be (logically) part of the SGA!

First of all check (or enable) the archiver:

SQL> select log_mode from V$DATABASE;
LOG_MODE
------------
ARCHIVELOG

Enable In-Memory Option: True Cache heavily relies on Oracle’s In-Memory option. Make sure this option is enabled in your Oracle Database, docu says minimum value should be 100MB, maximum 16GB for each RAC-instance – I think that’s not really helpful 😉 Within the SGA, the INMEMORY_SIZE parameter specifically allocates memory for the In-Memory Column Store (IMCS). As INMEMORY_SIZE is a static parameter, changes require a database restart to take effect:

--setting parameter
ALTER SYSTEM SET INMEMORY_SIZE = <size_in_GB> SCOPE = SPFILE;
--restart database
SHUTDOWN IMMEDIATE;
STARTUP;
--verify configuration
SELECT * FROM V$INMEMORY_AREA;

Enable True Cache Feature: now you can enable the True Cache feature within the database:

ALTER SYSTEM SET true_cache_enable = TRUE;

Configure Data Structures: Identify and mark the tables or table-partitions that should be cached in memory with the INMEMORY attribute:

--marking tables for in-memory-caching
ALTER TABLE <table_name> INMEMORY;
...
--monitoring performance
SELECT segment_name, populate_status FROM v$im_segments;

Be aware of the Memory Requirements, which means that sufficient memory allocations can be made: The primary requirement for True Cache is having enough memory to accommodate the data structures you want to cache. This can vary significantly depending on your workload.
Ensure that your system has a balanced configuration where enough memory is allocated to the buffer cache, PGA, and other critical areas while still reserving sufficient memory for True Cache operations.
The easiest way to get an overwiew over your true cache performance is via V$TRUE-CACHE, which is available since Oracle 23ai.

SELECT * FROM V$TRUE_CACHE;

Key columns are:

STATUS: The current status of True Cache.

BUFFER_CACHE_SIZE: The size of the buffer cache in use.

QUERIES_SATISFIED_FROM_CACHE: Number of queries satisfied using only the buffer cache.

DISK_READS_AVOIDED: Number of disk reads avoided due to True Cache.

MEMORY_USED: Amount of memory used by True Cache.

Summary of True Cache Advancements in Oracle 23ai:

Performance: True Cache provides improved performance for read-only workloads by maximizing the use of in-memory data and reducing disk I/O.

Resource Utilization: It minimizes disk usage, offering a mostly diskless replication environment.

Simplicity: Enhanced automation and integration with Oracle’s autonomous capabilities simplify cache management.

Targeted Functionality: Specifically designed for environments needing fast, read-only access to data with high reliability and low latency.

https://docs.oracle.com/search/?q=true+cache&lang=en&category=database&product=en%2Fdatabase%2Foracle%2Foracle-database%2F23

https://blogs.oracle.com/database/post/introducing-oracle-true-cache

https://blogs.oracle.com/coretec/post/true-cache-in-23ai-free

https://www.oracle.com/database/truecache/faq

https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/INMEMORY_SIZE.html

L’article Oracle 23ai – True Cache est apparu en premier sur dbi Blog.


Viewing all articles
Browse latest Browse all 66

Trending Articles