The invention discloses a
cache optimization method and device based on distributed storage, and relates to the technical field of distributed storage systems. The method comprises the following steps: dynamically calculating a
weight factor of a cache file, attenuating the
weight factor based on the
access frequency and timeliness of the file, and compensating and adjusting according to the size of the file; the maximum file threshold
value set by the
system is dynamically adjusted according to the size distribution of the files in the cache, and the maximum file threshold value is determined based on a preset quantile range so as to eliminate interference of extremely large files on weight calculation; when the
weight factor of the cache file is lower than a preset threshold value, the file is removed from the cache, and the cache space is released; when the
cache capacity is insufficient, the file with the
minimum weight is selected for replacement based on the weight factor of the current cache file, and the high-value file is preferentially reserved in the cache. According to the method, the
cache hit rate of
small files in the distributed storage
system is effectively increased, cache space waste and
metadata operation overhead are reduced, and
system performance and
resource utilization rate are remarkably improved.