danielealbano / cachegrand

cachegrand - a modern data ingestion, processing and serving platform built for today's hardware
BSD 3-Clause "New" or "Revised" License
975 stars 34 forks source link

Move the keys eviction onto a fiber and improve efficiency with auto-tuning of the aggressiveness depending on the proximity to the hard limit #310

Closed danielealbano closed 1 year ago

danielealbano commented 1 year ago

This pull request moves the keys eviction code onto an ad-hoc fiber and enhances the eviction process file by implementing a proximity-based aggressiveness auto-tuning mechanism to optimize key eviction efficiency and balance out the amount of resources required. The eviction process is adjusted based on the proximity to the hard limit, with reduced wait times for closer limits. The logic ensures an optimized eviction process by running until sufficient data is freed up when approaching the hard limit threshold.

When very close to the hard limit (99%) then a very aggressive mechanism kicks in to reduce the memory consumption below the threshold.