Smart Flash Cache
By Ahmed Baraka
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Objectives
In this lecture, you should learn how to perform the following:
• Describe Smart Flash Cache mechanism
• Configure Smart Flash Cache
• Set the size of Smart Flash Cache
• Dynamically enable and disable a Flash Device
• Set FLASH_CAHCE attributes
• Describe Flash Cache related statistics
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA
Buffer Cache: xGB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA
Buffer Cache: xGB
Flash Disk: SSD
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA
Buffer Cache: xGB
Flash Disk: SSD
Flash Cache: 2-10x GB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA Flash
buffer
Buffer Cache: xGB area
Flash Disk: SSD
Flash Cache: 2-10x GB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA Flash
buffer
Buffer Cache: xGB area
Flash Disk: SSD
Flash Cache: 2-10x GB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA Flash
buffer
Buffer Cache: xGB area
Flash Disk: SSD
Flash Cache: 2-10x GB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache
SGA Flash
buffer
Buffer Cache: xGB area
Flash Disk: SSD
Flash Cache: 2-10x GB
Oracle© Database Performance Tuning - a course by Ahmed Baraka
About Smart Flash Cache
• Aims at extending the buffer cache into a flash memory disk (SSD)
• Pros: affordable solution to significantly extend buffer cache, which
leads to increase the entire database performance
• Cons: less efficient than RAM
• SSD must have write IOPs comparable to read IOPs.
• Available only in Linux and Solaris systems
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Configuring Smart Flash Cache
• To configure the Smart Flash Cache:
Parameter Description
DB_FLASH_CACHE_FILE Full path file name(s) for the flash memory disk or disk
group (separated by commas) (static parameter)
DB_FLASH_CACHE_SIZE the size of each configured disk in the Smart Flash Cache
(separated by commas)
• Restrictions:
- Non-standard block size is not supported
- Size cannot be dynamically changed
- Flash disk file cannot be shared by multiple instances
- Up to 16 file names can be specified
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Configuring Smart Flash Cache: Examples
• Using a raw device:
DB_FLASH_CACHE_FILE = '/dev/roa1'
• File system mounted on a device:
DB_FLASH_CACHE_FILE = '/work/flash_cache.dbf'
• ASM disk group:
DB_FLASH_CACHE_FILE = '+FLASH_DG/flash_cache'
• Multiple devices:
DB_FLASH_CACHE_FILE = '/dev/sdb', '/dev/sdc', '/dev/sdd'
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Sizing Database Smart Flash Cache
• 2-10 times the size of the buffer cache
• 100 bytes (for single instance) to 200 (for RAC) bytes will be taken from
the buffer cache for each block in the flash cache
• Flash cache is not auto-tune when AMM is in place
• Flash disk size cannot be changed dynamically but
DB_FLASH_CACHE_SIZE can be used to enable or disable a flash disk
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Dynamically Enabling and Disabling a Flash Device
• If the flash devices are configured as follows:
DB_FLASH_CACHE_FILE = '/dev/sdb', '/dev/sdc', '/dev/sdd‘
DB_FLASH_CACHE_SIZE = 32G , 64G, 32G
• /dev/sdc can be disabled with by the following statement:
ALTER SYSTEM SET DB_FLASH_CACHE_SIZE='32G , 0G, 32G';
• It can be enabled again with by the following statement:
ALTER SYSTEM SET DB_FLASH_CACHE_SIZE='32G , 64G, 32G';
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Setting FLASH_CAHCE Attributes
• Syntax of FLASH_CACHE option:
... STORAGE ( FLASH_CACHE { DEFAULT | KEEP | NONE } );
Attribute Description
DEFAULT Object blocks will be written to the flash cache when they are aged out of
main memory. They might be aged out with a standard LRU algorithm.
KEEP Object buffers will be written to the flash cache when they are aged out of
main memory. They are kept in the flash cache as long as it is large enough
NONE Object buffers never get cached into the flash cache
• Example:
CREATE TABLE orders..TABLESPACE tbs_sale STORAGE (FLASH_CACHE KEEP)
• Check FLASH_CACHE in *_TABLES, *_INDEXES or *_CLUSTERS
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Flash Cache Related Statistics
• Flash Cache I/O statistics (in V$SYSSTAT and V$SESSTAT):
- 'physical read flash cache hits'
- 'db flash cache single block physical read'
- 'db flash cache multiblock physical read'
• FLASH_READS in V$SQL, V$SQLSTATS, V$SQLAREA, V$FILESTAT
• Flash Cache specific statistics can be obtained from
V$FLASHFILESTAT
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Smart Flash Cache in Real Life
• Required patches:
- 11g R2 (11.2.0.1): Patch# 8974084
- 11g R2 (11.2.0.3): Patch# 12949806
- For 12c R1 on OL7: Patch# 19504946
• Read-mostly and read-only workloads are likely to see the greatest
benefit
Oracle© Database Performance Tuning - a course by Ahmed Baraka
Summary
In this lecture, you should have learnt how to perform the following:
• Describe Smart Flash Cache mechanism
• Configure Smart Flash Cache
• Set the size of Smart Flash Cache
• Dynamically enable and disable a Flash Device
• Set FLASH_CAHCE attributes
• Describe Flash Cache related statistics
Oracle© Database Performance Tuning - a course by Ahmed Baraka