Today, with the development of SSD, mechanical Hard Disk Drive and SSD are widelyadopted in main Storage System gradually. The SSD has excellent random I/O performancebut it’s very expensive, while the HDD has very large capacity and much cheaper; they arecomplementation in different aspects if used to provide a good storage solution. TheFlashcache is an example how they work each other. Flashcache is designed andimplemented under Linux Device Mapper architecture, derives from the prototype of DMCache. It is a universal linux module. It takes advantage of the excellent performance ofSSD to make SSD a cache between HDD and RAM, in order to accelerating block device.But the Flashcache itself has some wake points, and can be optimized. There are manymodules which use Device Mapper, such as Linux soft RAID, LVM. This article discussedthe Implementation of Flashcache in both principle and code, and pointed out the fault ofFlashcache, then gave out the optimization.For one aspect, Flashcache was implemented without considering parallel I/O, all therequest was processed one by one serially. But the parallel performance of SSD is excellent,transforming from serialization I/O to parallel I/O can make it very effective. This articlemainly discussed transforming from serialization I/O to parallel I/O by adopting modernmultithread programming method, and adopting Fine-grained Locks to maximize theparallelism I/O. For another aspect, Flashcache cache all kinds of request by default. In fact,the sequential performance of SSD is not obvious when compared to the HDD of RAIDcomposed with several HDDs. Caching these sequential I/O won’t get a strong boost for theStorage System, on the contrary, may wasting many SSD space and increasing SSD’s burden.By classifying the I/O, only caching random I/O on SSD, skipping sequential I/O willincrease the overall performance of Flashcache. The two aspects will be testified byexperimental data. |