trafficserver icon indicating copy to clipboard operation
trafficserver copied to clipboard

Improve seen list for the RAM cache

Open zwoop opened this issue 1 year ago • 2 comments

This is work continued from Jeff's initial discovery and code. This patch will do:

  1. Change the seen filter to a bitset (1/16th the size)
  2. Removes the smallest hash bucket sizes (this is 2023)
  3. Doubles the size of the seen filter (less collisions)
  4. Ignores collisions in the seen filter completely
  5. Optionally enables the seen filter at a certain fill %
  6. Avoids LRU hash collisions by resizing early (75% fill)

The net effect is that we avoid the issues Jeff discovered by both reducing collision probability, and then accept some "false positive" RAM cache promotions to make sure collisions never happens. We accept that it's ok to add a little too much to the RAM cache is better than not adding it at all. And, once the cache is properly fill, all the improvements around collisions should make this very rare.

In addition, the optional feature to only use the seen filter when the RAM cache is at a certain fill percentage makes startup less straneous on the disks. Essentially, it will quickly fill the RAM cache with popular (and some unpopular) content reducing the disk I/O at startup by up to 50% (probably less though).

The changes also reduces the size of the seen filter by 87.5%.

Co-Author: Jeff Elsloo

zwoop avatar Oct 23 '23 22:10 zwoop

[approve ci format]

bneradt avatar Nov 15 '23 16:11 bneradt

Cherry-picked to v10.0.x

cmcfarlen avatar Apr 05 '24 17:04 cmcfarlen