Database Smart Flash Cache

Applies to:  Database Management Software Oracle Server - Enterprise Edition - Version: - Release: 11.2

Till now, in database software we used to have three type of storage.

1. RAM: Used for database processing.
2. Hard Disk: To store data and backup/recovery purpose.
3. Tape drives: For backup/recovery purpose.

Now a days, We can also see another storage device in market know as FLASH DRIVES commonly used for multimedia purpose. Following are the advantages of FLASH DRIVES.

1. Large capacity and cheaper as compared to RAM.
2. Fast throughput and latency compared to Disks.
3. Performance improvement up to a degree of level.

Oracle started using this storage media into Database Servers to claim better performance and known as Database Smart Flash Cache. Let's see how it works.

Smart Flash Cache is basically an extension of buffer cache. Whenever there is a read request in DB, data is fetched from hard disk and placed into buffer cache. As per LRU algorithms when data blocks are aged out from buffer it goes to smart flash cache instead of going back to hard disk (In traditional systems).

Here, we have placed flash cache in between buffer cache and hard disk and block which are aged out of buffer cache are place into it.
When there is a next request for a block, the request will first go to buffer cache then Flash Cache and after that hard disk. Here, we have an extension of Buffer cache, Physical read of data from Hard disk takes around 10ms while from Flash Cache it takes around 1MS. Since, Flash Cache is of 5 to 10 times in size of buffer cache it gives a higher degree of performance.

In a database system when physical memory is exhaust and to claim better performance only option is to buy more memory, which has two issue.

a. RAM per GB is expensive.
b. System might not have enough DDR Slots.

So you may be forced to upgrade your machine. Here, Flash Drives are the perfect rescue for the same price of memory you can buy 5 to 10 times in size of Flash Drive.After extension of buffer cache if whole database can fit into flash cache there is a very little cache I/O to Hard Disk besides for checkpoint writes and direct I/O.

The Response time for overall system has improved many folds with same RAM but additional Flash Drives.

Architecture of DB Smart Flash Cache:

When a process tries to access a block if this is not in memory it will read from Disk to buffer cache. Since, the buffer size is limited so, to claim space for other blocks existing blocks are aged out on LRU basis.
With the DB Smart Flash Cache, aged out blocks from buffer cache are written into flash cache by background process Database writer (DBWR). There are two lists DEFAULT flash LRU Chain and KEEP flash LRU Chain maintained in buffer cache having buffer header of buffer contents moved to Flash Cache. This list is maintained by following attributes of objects.

Flash Cache objects has three attributes:

1. Keep: Object having flash_cache value as "keep" will stay more in flash cache. They will not aged out from as long as there is enough space available.
2. None: Object having flash_cache value as "none" will not copy into in flash cache.
3. Default: Object having flash_cache value as "Default" will stay less into flash cache and will be aged out on the basis of LRU.

Command to add object in flash cache

create table f_cache (name varchar2(10)) tablespace tabs_1 storage (flash_keep keep|default|None);

No comments:

Post a Comment