Class BackupVersionOptimizationService

  • All Implemented Interfaces:
    ResourceReadUsageTracker,, java.lang.AutoCloseable

    public class BackupVersionOptimizationService
    extends AbstractVeniceService
    implements ResourceReadUsageTracker
    This class is used to periodically scan inactive store versions and perform optimization if the inactive period of some store version meets the pre-configured threshold, this class will trigger the database reopen action to unload unnecessary RAM usage, which was built up when there were active reads coming. The optimization follows the following rules: 1. Don't touch current version no matter whether it is being actively used in the read path or not. 2. Don't touch versions, which are not ready-to-serve yet. 3. If some specific store version is ready-to-serve, but haven't been active recently, this class will reopen all the storage partitions belonging to the inactive version to free up unnecessary RAM usage. 4. Don't reopen the database again if there is no more read usage after the optimization. This optimization is mainly for RocksDBStorageEngine. 1. Block-based format. Reopening the database will release the index/filter usages from the shared block cache. 2. Plain-table format. Reopening the database will un-mmap the file contents, which were brought into memory by the past read requests.
    • Constructor Detail

      • BackupVersionOptimizationService

        public BackupVersionOptimizationService​(ReadOnlyStoreRepository storeRepository,
                                                StorageEngineRepository storageEngineRepository,
                                                long noReadThresholdMSForDatabaseOptimization,
                                                long scheduleIntervalSeconds,
                                                BackupVersionOptimizationServiceStats stats)
        Allocate and initialize a new BackupVersionOptimizationService object.
        storeRepository - provides readonly operations to access stores.
        storageEngineRepository - local storage engines for a server node.
        noReadThresholdMSForDatabaseOptimization - controls the no read threshold for database optimization to kick in.
        scheduleIntervalSeconds - sets the scheduling interval for this service.
        stats - records the statistics for this service.