In earlier post in the series, we have learnt about various file system level settings to get more out of SmartIO. But many times a single file system has files and folders with different access characteristics and performance requirements. In majority of these scenarios, default SmartIO settings and algorithms work well. But some administrators might want to have more granular control, and in this blog post we will see how such wishes can be fulfilled.
Pinning a file
As expected from a standard caching solution, SmartIO does evict data from cache based on access pattern. But there can be certain files which are not heavily accessed (and hence will be evicted by eviction algorithm) but need excellent access performance. We can maintain those files in SmartIO cache by pinning them to cache. If access requirements change, they can be unpinned. A file will anyways be unpinned from the cache, when it is deleted.
#sfcache pin /mnt1/file1 #sfcache unpin /mnt1/file1
Pre-loading a file
Generally a file gets loaded into file when it is accessed, depending on access frequency. But what if we want to get best access performance even when a file is read for the first time? SmartIO provides support for that too. We can pre-load a file to cache explicitly. The pre-loading can happen synchronously or asynchronously as necessary. We can even pre-load and pin a file together, so that it gets loaded into cache and remains there unless explicitly removed.
#sfcache load –o sync /mnt1/file1 #sfcache load /mnt1/file2 #sfcache pin –o load /mnt1/file1
Both of the earlier options are about getting a file into cache and keeping it there. But SSD is a costly resource and we should use it judiciously. What if there is a file which gets accessed, but we are not worried too much about its access performance? We will obviously not like such a file occupying SSD space, and thereby denying the space to a better candidate. SmartIO provides options through which we can specify that a file should never be cached, no matter how frequently and how many times it is accessed.
#sfcache set mode=nocache /mnt1/file1
Folder level settings
All the above settings can be applied on a folder level. In such a case all the files and sub-folders will inherit the setting. In fact, even files created later on will inherit the settings from the parent folder.
#sfcache pin –r /mnt1/dir1 #sfcache set mode=nocache /mnt1/dir1
“Okay, those sound great, but I don’t know access patterns for individual files”. If we are faced with such a scenario, then for applications like Oracle, SmartIO provides a solution. We use our understanding of the application, and use standard tools to find out how various files are accessed, and uses options mentioned above to ensure that the application gets maximum benefit out of SmartIO. An administrator can set it up using
#sfcache app cachearea=cache1 oracle –S testdb –H /home/oracle –o setdefaults -–type=OLTP
and as always, an administrator can override the settings if necessary.
In this blog post, we have learnt about how SmartIO caching can be tuned at a file or folder level. As always, please leave a comment to share how you are using these settings and if you are looking for any further tunings. Enjoy caching!
For more details regarding SmartIO commands and use cases, we can refer to admin guide.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.