| With the rapid development of the Internet and the blowout growth of data scale,more and more applications have changed from CPU-intensive applications to I/O-intensive applications.Since there is a large performance gap between a high-speed CPU and a slow external storage device,the cache system is an important method to make up for the performance gap between different I/O levels.Nowadays,there are cache systems for specific application scenarios or storage devices,but few works are designed and optimized for the file system.In the design and optimization of a file system-oriented cache system,efficiency is a key indicator to focus on,which is important for improving the data I/O performance and the computer system efficiency.In addition,because the space capacity of the cache system is limited and much smaller than that of external storage devices,designing an appropriate cache replacement strategy for the cache system can the space utilization of the cache system and reduce the number of cache replacements.Based on the above starting point,this paper proposes a redesigned cache system based on the characteristics of the file system,so that the cache system can adapt to the file system.In addition,the cache system proposed in this paper has the advantages of high efficiency,high space utilization,and fewer cache replacement times.The main contributions of this paper are as follows:1.This paper first analyzes the performance of the traditional cache system.The experimental exploration and analysis are conducted from the perspectives of cache system efficiency and cache replacement strategy,respectively,and their shortcomings are found.Then,this paper designs and implements an efficient file caching system based on the file system,which has the performance advantages of high efficiency,high space utilization,and few cache replacements.2.For the efficiency of the cache system,this paper designs and optimizes two aspects:the cache key and the cache index structure.In terms of the cache key,this paper uses the characteristics of the file system to optimize the new cache key and supports the parallel obtaining of such cache key and physical address.In terms of the cache index structure,this paper uses the hash table,and compares multiple different hash functions on the three indicators of efficiency,uniformity,and average bucket length through experiments,and then selects the one that is more suitable for the above cache key according to the experimental results.3.For the cache replacement strategy,this paper designs and optimizes two aspects:without or with cache prefetching.Without cache prefetching,this paper designs an LRU-based replacement strategy.When meeting certain conditions,it will actively clear some data blocks to release the cache space and improve the cache space utilization.With cache prefetching,this paper also divides the cached data into hot and cold data areas,stipulates the rules for data blocks to enter the hot and cold data block areas,and regularly checks whether it is necessary to convert some hot data blocks into cold data blocks.The experimental results show that the cache system proposed in this paper exhibits higher efficiency and space utilization than other cache systems while reducing the number of cache replacements.In terms of the efficiency of the cache system,the cache system proposed in this paper improves by 18.0% ~69.3% on average.In terms of space usage of the cache system,the cache system proposed in this paper saves by 13.0% ~17.8% on average.In terms of the number of cache replacements,the cache system proposed in this paper reduces by 13.3% ~14.6% on average.In addition,this paper also analyzes the comparison of the impact of different replacement and replacement strategies on the cache efficiency under different prefetch strategies through experiments. |